I'm using the following code in some cases:
#define array_key_exists(find_key, arr) (arr.find(find_key) != arr.end())
But i also use simply this method:
if(SomeMap["something"]){
// key exists
}
I am using String to int map.
Are they both as fast...? Or is there a possibility for errors with the second case, assuming i am not using zero value in the map values at all? So far the second case seems to work just fine.