c++ - How to treat std::pair as two separate variables? -


there few functions in standard library, such std::map::insert, return std::pair. @ times convenient have populate 2 different variables corresponding halves of pair. there easy way that?

std::map<int,int>::iterator it; bool b; magic(it, b) = mymap.insert(std::make_pair(42, 1)); 

i'm looking magic here.

std::tie <tuple> header want.

std::tie(it, b) = mymap.insert(std::make_pair(42, 1)); 

"magic" :)

note: c++11 feature.


Comments

Popular posts from this blog

rest - Spring boot: Request method 'PUT' not supported -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

symfony - imagine_filter() not generating the correct url in LiipImagineBundle -