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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - How can I merge Nodes & Webform Submissions into instances of one general Content Type in Drupal 6? -