c++ - How to check if std::map contains a key without doing insert? -


the way have found check duplicates inserting , checking std::pair.second false, problem still inserts if key unused, whereas want map.contains(key); function.

use my_map.count( key ); can return 0 or 1, boolean result want.

alternately my_map.find( key ) != my_map.end() works too.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -