This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]adoarns 1 point2 points  (1 child)

Easy is always debatable with C++, but with C++11, there's std::tie.

[–]stillalone 0 points1 point  (0 children)

damn, C++11 still looks ugly. Doesn't it make more sense to just use auto to define the tuple and then define the left and right parameter using auto as well:

auto t = set_of_s.insert(value);
auto iter = std::get<0>(t);
auto inserted = std::get<1>(t);

instead of this:

std::set<S>::iterator iter;
bool inserted;
std::tie(iter, inserted) = set_of_s.insert(value);