SyntaxFix
Write A Post
Hire A Developer
Questions
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()