An Exert Operation
by Remy Porter
in CodeSOD
on 2025-07-28
The Standard Template Library for C++ is… interesting. A generic set of data structures and algorithms was a pretty potent idea. In practice, early implementations left a lot to be desired. Because the STL is a core part of C++ at this point, and widely used, it also means that it's slow to change, and each change needs to go through a long approval process.
Which is why the STL didn't have a std::map::contains
function until the C++20 standard. There were other options. For example, one could usestd::map::count
, to count how many times a key appear. Or you could use std::map::find
to search for a key. One argument against adding astd::map::contains
function is thatstd::map::count
basically does the same job and has the same performance.