forked from boostorg/container
Fix "count" with heterogeneous lookups in flat_map and flat_set
This commit is contained in:
1 parent
b383c0809a
commit
0c95d4846f
6 files changed
+27
-5
No files matched your search
@@ -925,7 +925,9 @@ class flat_set
|
||||
//! <b>Complexity</b>: log(size())+count(k)
|
||||
template<typename K>
|
||||
BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const
|
||||
{ return static_cast<size_type>(this->tree_t::find(x) != this->tree_t::cend()); }
|
||||
//Don't use find() != end optimization here as transparent comparators with key K might
|
||||
//return a different range than key_type (which can only return a single element range)
|
||||
{ return this->tree_t::count(x); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
@@ -1031,6 +1033,8 @@ class flat_set
|
||||
//! <b>Complexity</b>: Logarithmic
|
||||
template<typename K>
|
||||
std::pair<iterator,iterator> equal_range(const K& x)
|
||||
//Don't use lower_bound_range optimization here as transparent comparators with key K might
|
||||
//return a different range than key_type (which can only return a single element range)
|
||||
{ return this->tree_t::equal_range(x); }
|
||||
|
||||
//! <b>Requires</b>: This overload is available only if
|
||||
@@ -1041,6 +1045,8 @@ class flat_set
|
||||
//! <b>Complexity</b>: Logarithmic
|
||||
template<typename K>
|
||||
std::pair<const_iterator,const_iterator> equal_range(const K& x) const
|
||||
//Don't use lower_bound_range optimization here as transparent comparators with key K might
|
||||
//return a different range than key_type (which can only return a single element range)
|
||||
{ return this->tree_t::equal_range(x); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
Reference in new issue
Block a user