Why isn’t there a ‘find’ function in associative std containers (map, set, etc) that returns a boolean?
Say:
std::map <int,int> mMap;
...
if ( mMap.contains(75) ) ...
I know about the find() and that I can do it this way
if ( mMap.find(75) != mMap.end() ) ...
But I feel it clutters the code more than anything else.
Why isn’t there a simpler function for this, I mean containers are quite much about finding things in them?
You can make your own (note, it’s “HasKey” because “Contains” would deal with values)