Skip to content

Commit 2932339

Browse files
committed
Fix transparent erase signature to "K&&"
1 parent 73d91c5 commit 2932339

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

include/boost/container/detail/flat_tree.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,8 +1175,9 @@ class flat_tree
11751175
!dtl::is_convertible<K, iterator>::value && //not convertible to iterator
11761176
!dtl::is_convertible<K, const_iterator>::value //not convertible to const_iterator
11771177
, size_type>::type
1178-
erase(const K& k)
1178+
erase(BOOST_FWD_REF(K) key)
11791179
{
1180+
const typename remove_cvref<K>::type & k = key; //Support emulated rvalue references
11801181
std::pair<iterator, iterator > itp = this->equal_range(k);
11811182
size_type ret = static_cast<size_type>(itp.second - itp.first);
11821183
if (ret) {

include/boost/container/detail/tree.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,11 @@ class tree
11521152
!dtl::is_convertible<K, iterator>::value && //not convertible to iterator
11531153
!dtl::is_convertible<K, const_iterator>::value //not convertible to const_iterator
11541154
, size_type>::type
1155-
erase(const K& k)
1156-
{ return AllocHolder::erase_key(k, KeyNodeCompare(key_comp()), alloc_version()); }
1155+
erase(BOOST_FWD_REF(K) key)
1156+
{
1157+
const typename remove_cvref<K>::type & k = key; //Support emulated rvalue references
1158+
return AllocHolder::erase_key(k, KeyNodeCompare(key_comp()), alloc_version());
1159+
}
11571160

11581161
template <class K>
11591162
inline typename dtl::enable_if_c<

include/boost/container/flat_map.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ class flat_map
13331333
!dtl::is_convertible<K BOOST_MOVE_I iterator>::value && //not convertible to iterator
13341334
!dtl::is_convertible<K BOOST_MOVE_I const_iterator>::value //not convertible to const_iterator
13351335
BOOST_MOVE_I size_type>::type)
1336-
erase(const K& x)
1336+
erase(BOOST_FWD_REF(K) x)
13371337
{ return m_flat_tree.erase_unique(x); }
13381338

13391339
//! <b>Effects</b>: Erases all the elements in the range [first, last).

include/boost/container/map.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ class map
10321032
!dtl::is_convertible<K BOOST_MOVE_I iterator>::value && //not convertible to iterator
10331033
!dtl::is_convertible<K BOOST_MOVE_I const_iterator>::value //not convertible to const_iterator
10341034
BOOST_MOVE_I size_type>::type)
1035-
erase(const K& x)
1035+
erase(BOOST_FWD_REF(K) x)
10361036
{ return this->base_t::erase_unique(x); }
10371037

10381038
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)

0 commit comments

Comments
 (0)