From 77c4a09a9bb0adc72c40a1323c67be28ec20c662 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 21 Dec 2021 14:51:25 -0800 Subject: [PATCH] Implement heterogeneous `count()` for multimap --- include/boost/unordered/unordered_map.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index 20537bfa..f5d59c19 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -1487,6 +1487,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&); std::pair equal_range( const key_type&) const;