summaryrefslogtreecommitdiff
path: root/libcxx/include/deque
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-07-26 19:36:28 +0000
commitcfca06d7963fa0909f90483b42a6d7d194d01e08 (patch)
tree209fb2a2d68f8f277793fc8df46c753d31bc853b /libcxx/include/deque
parent706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff)
Notes
Diffstat (limited to 'libcxx/include/deque')
-rw-r--r--libcxx/include/deque24
1 files changed, 16 insertions, 8 deletions
diff --git a/libcxx/include/deque b/libcxx/include/deque
index 115b1b642701..c2ea5f2dbe6d 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -150,9 +150,11 @@ template <class T, class Allocator>
noexcept(noexcept(x.swap(y)));
template <class T, class Allocator, class U>
- void erase(deque<T, Allocator>& c, const U& value); // C++20
+ typename deque<T, Allocator>::size_type
+ erase(deque<T, Allocator>& c, const U& value); // C++20
template <class T, class Allocator, class Predicate>
- void erase_if(deque<T, Allocator>& c, Predicate pred); // C++20
+ typename deque<T, Allocator>::size_type
+ erase_if(deque<T, Allocator>& c, Predicate pred); // C++20
} // std
@@ -3021,14 +3023,20 @@ swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
#if _LIBCPP_STD_VER > 17
template <class _Tp, class _Allocator, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY
-void erase(deque<_Tp, _Allocator>& __c, const _Up& __v)
-{ __c.erase(_VSTD::remove(__c.begin(), __c.end(), __v), __c.end()); }
+inline _LIBCPP_INLINE_VISIBILITY typename deque<_Tp, _Allocator>::size_type
+erase(deque<_Tp, _Allocator>& __c, const _Up& __v) {
+ auto __old_size = __c.size();
+ __c.erase(_VSTD::remove(__c.begin(), __c.end(), __v), __c.end());
+ return __old_size - __c.size();
+}
template <class _Tp, class _Allocator, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
-void erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred)
-{ __c.erase(_VSTD::remove_if(__c.begin(), __c.end(), __pred), __c.end()); }
+inline _LIBCPP_INLINE_VISIBILITY typename deque<_Tp, _Allocator>::size_type
+erase_if(deque<_Tp, _Allocator>& __c, _Predicate __pred) {
+ auto __old_size = __c.size();
+ __c.erase(_VSTD::remove_if(__c.begin(), __c.end(), __pred), __c.end());
+ return __old_size - __c.size();
+}
#endif