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

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -