mirror of
https://github.com/boostorg/container.git
synced 2026-01-19 04:02:17 +00:00
Add small test to set/flat_map for transparent erase
This commit is contained in:
@@ -801,6 +801,15 @@ class flat_set
|
||||
//! linear to the elements with bigger keys.
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
|
||||
//! <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.
|
||||
template<class K>
|
||||
size_type erase(K && k);
|
||||
|
||||
//! <b>Effects</b>: Swaps the contents of *this and x.
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing.
|
||||
@@ -1736,6 +1745,10 @@ class flat_multiset
|
||||
//! @copydoc ::boost::container::flat_set::erase(const_iterator,const_iterator)
|
||||
iterator erase(const_iterator first, const_iterator last);
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::erase(K&&)
|
||||
template<class K>
|
||||
size_type erase(K && k);
|
||||
|
||||
//! @copydoc ::boost::container::flat_set::swap
|
||||
void swap(flat_multiset& x)
|
||||
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
|
||||
|
||||
@@ -580,6 +580,16 @@ bool test_heterogeneous_lookups()
|
||||
if(*cmset1.equal_range(find_me).second != 3)
|
||||
return false;
|
||||
|
||||
//erase
|
||||
if (set1.erase(find_me) != 1)
|
||||
return false;
|
||||
if (set1.erase(find_me) != 0)
|
||||
return false;
|
||||
if (mset1.erase(find_me) != 2)
|
||||
return false;
|
||||
if (mset1.erase(find_me) != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -437,6 +437,16 @@ bool test_heterogeneous_lookups()
|
||||
if(*cmset1.equal_range(find_me).second != 3)
|
||||
return false;
|
||||
|
||||
//erase
|
||||
if (set1.erase(find_me) != 1)
|
||||
return false;
|
||||
if (set1.erase(find_me) != 0)
|
||||
return false;
|
||||
if (mset1.erase(find_me) != 2)
|
||||
return false;
|
||||
if (mset1.erase(find_me) != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user