From d5e5c08b875e1d4ef2e0bd1354ebfd8e218fd2d7 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Mon, 3 Jan 2022 14:43:51 -0800 Subject: [PATCH] Implement heterogeneous `count()` for multiset --- include/boost/unordered/unordered_set.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index 81f6e2f4..92ab11c5 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -1092,6 +1092,18 @@ namespace boost { size_type count(const key_type&) const; + template + typename boost::enable_if_c::value, + size_type>::type + count(const Key& k) const + { + node_pointer n = table_.find_node_impl( + table::policy::apply_hash(this->hash_function(), k), k, + this->key_eq()); + + return n ? table_.group_count(n) : 0; + } + std::pair equal_range( const key_type&) const;