summaryrefslogtreecommitdiffstats
path: root/include/deque
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2015-06-05 22:34:19 +0000
committerMarshall Clow <mclow.lists@gmail.com>2015-06-05 22:34:19 +0000
commit4356f6392e67b6d9d680f5c4b06c62ff9e4fee3b (patch)
tree506a5aefe206fbcc9607b37ccf1c5ad9dad88e83 /include/deque
parent64c62484998b786c90191793adede7cd1b406972 (diff)
downloadexternal_libcxx-4356f6392e67b6d9d680f5c4b06c62ff9e4fee3b.tar.gz
external_libcxx-4356f6392e67b6d9d680f5c4b06c62ff9e4fee3b.tar.bz2
external_libcxx-4356f6392e67b6d9d680f5c4b06c62ff9e4fee3b.zip
Fix PR#23767. Add tests for iterator invalidation for deque::erase/pop_front/pop_back
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239196 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/deque')
-rw-r--r--include/deque4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/deque b/include/deque
index 78ef118c3..a372560f6 100644
--- a/include/deque
+++ b/include/deque
@@ -2699,7 +2699,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
difference_type __pos = __f - __b;
iterator __p = __b + __pos;
allocator_type& __a = __base::__alloc();
- if (__pos < (__base::size() - 1) / 2)
+ if (__pos <= (__base::size() - 1) / 2)
{ // erase from front
_VSTD::move_backward(__b, __p, _VSTD::next(__p));
__alloc_traits::destroy(__a, _VSTD::addressof(*__b));
@@ -2737,7 +2737,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
if (__n > 0)
{
allocator_type& __a = __base::__alloc();
- if (__pos < (__base::size() - __n) / 2)
+ if (__pos <= (__base::size() - __n) / 2)
{ // erase from front
iterator __i = _VSTD::move_backward(__b, __p, __p + __n);
for (; __b != __i; ++__b)