mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-24 03:32:35 +08:00
Implement P1209 - Adopt Consistent Container Erasure from Library Fundamentals 2 for C++20. Reviewed as https://reviews.llvm.org/D55532
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@349178 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
22
include/map
22
include/map
@@ -254,6 +254,10 @@ void
|
||||
swap(map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class Key, class T, class Compare, class Allocator, class Predicate>
|
||||
void erase_if(map<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
|
||||
|
||||
|
||||
template <class Key, class T, class Compare = less<Key>,
|
||||
class Allocator = allocator<pair<const Key, T>>>
|
||||
class multimap
|
||||
@@ -465,6 +469,9 @@ swap(multimap<Key, T, Compare, Allocator>& x,
|
||||
multimap<Key, T, Compare, Allocator>& y)
|
||||
noexcept(noexcept(x.swap(y)));
|
||||
|
||||
template <class Key, class T, class Compare, class Allocator, class Predicate>
|
||||
void erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // C++20
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
@@ -1614,6 +1621,14 @@ swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred)
|
||||
{ __libcpp_erase_if_container(__c, __pred); }
|
||||
#endif
|
||||
|
||||
|
||||
template <class _Key, class _Tp, class _Compare = less<_Key>,
|
||||
class _Allocator = allocator<pair<const _Key, _Tp> > >
|
||||
class _LIBCPP_TEMPLATE_VIS multimap
|
||||
@@ -2151,6 +2166,13 @@ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void erase_if(multimap<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred)
|
||||
{ __libcpp_erase_if_container(__c, __pred); }
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_MAP
|
||||
|
Reference in New Issue
Block a user