Fixes #241: flat_map should support same interface as std::map

This commit is contained in:
Ion Gaztañaga
2024-06-28 14:04:00 +02:00
parent 6f10e52887
commit df03ffc8ec
8 changed files with 142 additions and 3 deletions
+17
View File
@@ -969,6 +969,23 @@ class map
inline size_type erase(const key_type& x)
{ return this->base_t::erase_unique(x); }
//! <b>Requires</b>: This overload is available only if
//! key_compare::is_transparent exists.
//!
//! <b>Effects</b>: If present, erases the element in the container with key equivalent to x.
//!
//! <b>Returns</b>: Returns the number of erased elements (0/1).
template <class K>
inline BOOST_CONTAINER_DOC1ST
(size_type
, typename dtl::enable_if_c<
dtl::is_transparent<key_compare>::value && //transparent
!dtl::is_convertible<K BOOST_MOVE_I iterator>::value && //not convertible to iterator
!dtl::is_convertible<K BOOST_MOVE_I const_iterator>::value //not convertible to const_iterator
BOOST_MOVE_I size_type>::type)
erase(const K& x)
{ return this->base_t::erase_unique(x); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Erases the element pointed to by p.