The only way I have found to check for duplicates is by inserting and checking the std::pair.second for false, but the problem is that this still i
std::pair.second
false
Use my_map.count( key ); it can only return 0 or 1, which is essentially the Boolean result you want.
my_map.count( key )
Alternately my_map.find( key ) != my_map.end() works too.
my_map.find( key ) != my_map.end()