How to treat std::pair as two separate variables?
std::tie
from the <tuple>
header is what you want.
std::tie(it, b) = mymap.insert(std::make_pair(42, 1));
"magic
" :)
Note: This is a C++11 feature.
In C++17, you can use structured bindings. So you don't have to declare the variables first:
auto [it, b] = mymap.insert(std::make_pair(42, 1));