From 19d2fe87387911e5510c193d07fec57f3300880f Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Mon, 20 Dec 2021 09:28:04 -0800 Subject: [PATCH] Implement heterogeneous `equal_range()` for multimap --- include/boost/unordered/unordered_map.hpp | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index c9fd46d2..82cb7f80 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -1477,6 +1477,32 @@ namespace boost { std::pair equal_range( const key_type&) const; + template + typename boost::enable_if_c::value, + std::pair >::type + equal_range(const Key& key) + { + node_pointer p = table_.find_node_impl( + table::policy::apply_hash(this->hash_function(), key), key, + this->key_eq()); + + return std::make_pair( + iterator(p), iterator(p ? table_.next_group(p) : p)); + } + + template + typename boost::enable_if_c::value, + std::pair >::type + equal_range(const Key& key) const + { + node_pointer p = table_.find_node_impl( + table::policy::apply_hash(this->hash_function(), key), key, + this->key_eq()); + + return std::make_pair( + const_iterator(p), const_iterator(p ? table_.next_group(p) : p)); + } + // bucket interface size_type bucket_count() const BOOST_NOEXCEPT