forked from boostorg/container
* Implemented C++20 contains() for associative containers as specified in P0458R2.
* Fixed serious bug in heterogeneous lookup functions (is_transparent was broken).
This commit is contained in:
@@ -1340,6 +1340,24 @@ class flat_map
|
||||
BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const
|
||||
{ return static_cast<size_type>(m_flat_tree.find(x) != m_flat_tree.end()); }
|
||||
|
||||
//! <b>Returns</b>: Returns true if there is an element with key
|
||||
//! equivalent to key in the container, otherwise false.
|
||||
//!
|
||||
//! <b>Complexity</b>: log(size()).
|
||||
bool contains(const key_type& x) const
|
||||
{ return m_flat_tree.find(x) != m_flat_tree.end(); }
|
||||
|
||||
//! <b>Requires</b>: This overload is available only if
|
||||
//! key_compare::is_transparent exists.
|
||||
//!
|
||||
//! <b>Returns</b>: Returns true if there is an element with key
|
||||
//! equivalent to key in the container, otherwise false.
|
||||
//!
|
||||
//! <b>Complexity</b>: log(size()).
|
||||
template<typename K>
|
||||
bool contains(const K& x) const
|
||||
{ return m_flat_tree.find(x) != m_flat_tree.end(); }
|
||||
|
||||
//! <b>Returns</b>: An iterator pointing to the first element with key not less
|
||||
//! than k, or a.end() if such an element is not found.
|
||||
//!
|
||||
@@ -2631,6 +2649,24 @@ class flat_multimap
|
||||
BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const
|
||||
{ return m_flat_tree.count(x); }
|
||||
|
||||
//! <b>Returns</b>: Returns true if there is an element with key
|
||||
//! equivalent to key in the container, otherwise false.
|
||||
//!
|
||||
//! <b>Complexity</b>: log(size()).
|
||||
bool contains(const key_type& x) const
|
||||
{ return m_flat_tree.find(x) != m_flat_tree.end(); }
|
||||
|
||||
//! <b>Requires</b>: This overload is available only if
|
||||
//! key_compare::is_transparent exists.
|
||||
//!
|
||||
//! <b>Returns</b>: Returns true if there is an element with key
|
||||
//! equivalent to key in the container, otherwise false.
|
||||
//!
|
||||
//! <b>Complexity</b>: log(size()).
|
||||
template<typename K>
|
||||
bool contains(const K& x) const
|
||||
{ return m_flat_tree.find(x) != m_flat_tree.end(); }
|
||||
|
||||
//! <b>Returns</b>: An iterator pointing to the first element with key not less
|
||||
//! than k, or a.end() if such an element is not found.
|
||||
//!
|
||||
|
||||
Reference in New Issue
Block a user