Quantcast
Channel: How to find if a given key exists in a std::map - Stack Overflow
Viewing all articles
Browse latest Browse all 16

Answer by aJ. for How to find if a given key exists in a std::map

$
0
0
m.find == m.end() // not found 

If you want to use other API, then find go for m.count(c)>0

 if (m.count("f")>0)      cout << " is an element of m.\n";    else       cout << " is not an element of m.\n";

Viewing all articles
Browse latest Browse all 16

Trending Articles