std::unordered_multimap<Key,T,Hash,KeyEqual,Allocator>::contains
Min standard notice:
- Checks if there is an element with key equivalent to key in the container.
# Declarations
bool contains( const Key& key ) const;
(since C++20)
template< class K >
bool contains( const K& x ) const;
(since C++20)
# Parameters
key: key value of the element to search forx: a value of any type that can be transparently compared with a key
# Return value
true if there is such an element, otherwise false.
# Example
#include <iostream>
#include <unordered_map>
int main()
{
std::unordered_multimap<int, char> example{{1, 'a'}, {2, 'b'}};
for (int x : {2, 5})
if (example.contains(x))
std::cout << x << ": Found\n";
else
std::cout << x << ": Not found\n";
}