I am confused which is more efficient?
As we can access map directly, why do we need to use find?
I just need to know which way is more efficient.
This code and doc is picked from cplusplus.com
// accessing mapped values
#include
#include
Notice how the last access (to element 'd') inserts a new element in the map with that key and initialized to its default value (an empty string) even though it is accessed only to retrieve its value. Member function map::find does not produce this effect.