std::multiset<Key,Compare,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 <set>
int main()
{
std::multiset<int> example{1, 2, 3, 4};
for (int x : {2, 5})
if (example.contains(x))
std::cout << x << ": Found\n";
else
std::cout << x << ": Not found\n";
}