[cfe-commits] [libcxx] r111532 - in /libcxx/trunk: include/forward_list test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
Howard Hinnant
hhinnant at apple.com
Thu Aug 19 10:40:04 PDT 2010
Author: hhinnant
Date: Thu Aug 19 12:40:04 2010
New Revision: 111532
URL: http://llvm.org/viewvc/llvm-project?rev=111532&view=rev
Log:
LWG 1278
Modified:
libcxx/trunk/include/forward_list
libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
Modified: libcxx/trunk/include/forward_list
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/forward_list?rev=111532&r1=111531&r2=111532&view=diff
==============================================================================
--- libcxx/trunk/include/forward_list (original)
+++ libcxx/trunk/include/forward_list Thu Aug 19 12:40:04 2010
@@ -942,7 +942,7 @@
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
const value_type& __v)
{
- __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
+ __node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
@@ -977,6 +977,7 @@
#endif
__last->__next_ = __r->__next_;
__r->__next_ = __first;
+ __r = __last;
}
return iterator(__r);
}
@@ -991,7 +992,7 @@
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
_InputIterator __f, _InputIterator __l)
{
- __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
+ __node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
if (__f != __l)
{
__node_allocator& __a = base::__alloc();
@@ -1026,6 +1027,7 @@
#endif
__last->__next_ = __r->__next_;
__r->__next_ = __first;
+ __r = __last;
}
return iterator(__r);
}
Modified: libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp?rev=111532&r1=111531&r2=111532&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_init.pass.cpp Thu Aug 19 12:40:04 2010
@@ -27,14 +27,14 @@
assert(distance(c.begin(), c.end()) == 0);
i = c.insert_after(c.cbefore_begin(), {0, 1, 2});
- assert(i == c.before_begin());
+ assert(i == next(c.before_begin(), 3));
assert(distance(c.begin(), c.end()) == 3);
assert(*next(c.begin(), 0) == 0);
assert(*next(c.begin(), 1) == 1);
assert(*next(c.begin(), 2) == 2);
i = c.insert_after(c.begin(), {3, 4});
- assert(i == c.begin());
+ assert(i == next(c.begin(), 2));
assert(distance(c.begin(), c.end()) == 5);
assert(*next(c.begin(), 0) == 0);
assert(*next(c.begin(), 1) == 3);
Modified: libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp?rev=111532&r1=111531&r2=111532&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_range.pass.cpp Thu Aug 19 12:40:04 2010
@@ -32,14 +32,14 @@
assert(distance(c.begin(), c.end()) == 0);
i = c.insert_after(c.cbefore_begin(), J(t), J(t+3));
- assert(i == c.before_begin());
+ assert(i == next(c.before_begin(), 3));
assert(distance(c.begin(), c.end()) == 3);
assert(*next(c.begin(), 0) == 0);
assert(*next(c.begin(), 1) == 1);
assert(*next(c.begin(), 2) == 2);
i = c.insert_after(c.begin(), J(t+3), J(t+5));
- assert(i == c.begin());
+ assert(i == next(c.begin(), 2));
assert(distance(c.begin(), c.end()) == 5);
assert(*next(c.begin(), 0) == 0);
assert(*next(c.begin(), 1) == 3);
Modified: libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp?rev=111532&r1=111531&r2=111532&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/forwardlist/forwardlist.modifiers/insert_after_size_value.pass.cpp Thu Aug 19 12:40:04 2010
@@ -27,14 +27,14 @@
assert(distance(c.begin(), c.end()) == 0);
i = c.insert_after(c.cbefore_begin(), 3, 3);
- assert(i == c.before_begin());
+ assert(i == next(c.before_begin(), 3));
assert(distance(c.begin(), c.end()) == 3);
assert(*next(c.begin(), 0) == 3);
assert(*next(c.begin(), 1) == 3);
assert(*next(c.begin(), 2) == 3);
i = c.insert_after(c.begin(), 2, 2);
- assert(i == c.begin());
+ assert(i == next(c.begin(), 2));
assert(distance(c.begin(), c.end()) == 5);
assert(*next(c.begin(), 0) == 3);
assert(*next(c.begin(), 1) == 2);
More information about the cfe-commits
mailing list