From ad8a11bb4928c867df13b844f2495a63bfa16884 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Wed, 12 Jan 2022 11:31:54 -0800 Subject: [PATCH] Implement `unordered_multimap::contains()` --- include/boost/unordered/unordered_map.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index a7765fe7..bc3608e8 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -1502,6 +1502,23 @@ namespace boost { const_iterator find(CompatibleKey const&, CompatibleHash const&, CompatiblePredicate const&) const; + bool contains(key_type const& 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