Logo

Programming-Idioms

History of Idiom 51 > diff from v44 to v45

Edit summary for version 45 by Stanley:
New Cpp implementation by user [Stanley]

Version 44

2019-09-30, 06:30:40

Version 45

2019-09-30, 06:31:53

Idiom #51 Check if map contains key

Determine whether map m contains an entry for key k

Illustration

Idiom #51 Check if map contains key

Determine whether map m contains an entry for key k

Illustration
Extra Keywords
table dictionary hash
Extra Keywords
table dictionary hash
Imports
#include <map>
Code
bool key_exists = m.contains(k);
Comments bubble
Need C++20
Doc URL
https://en.cppreference.com/w/cpp/container/map/contains