From 97734fd8954753ee2b5c383f31a2f8e76240e5ff Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Thu, 13 Jan 2022 09:16:03 -0800 Subject: [PATCH] Implement `unordered_multiset::contains()` --- include/boost/unordered/unordered_set.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index 0210056d..d6f1abc3 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -1125,6 +1125,23 @@ namespace boost { const_iterator find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&) const; + bool contains(const key_type& k) const + { + return table_.find_node_impl( + table::policy::apply_hash(this->hash_function(), k), k, + this->key_eq()); + } + + template + typename boost::enable_if_c::value, + bool>::type + contains(const Key& k) const + { + return table_.find_node_impl( + table::policy::apply_hash(this->hash_function(), k), k, + this->key_eq()); + } + size_type count(const key_type&) const; template