[libcxx] r202741 - Implement LWG 2324: Insert iterator constructors should use addressof(). Add two new container classes to the test suite that overload operator &, and add test cases to the insert/front_insert/back_insert iterator tests that use these containers.
Marshall Clow
mclow.lists at gmail.com
Mon Mar 3 11:20:41 PST 2014
Author: marshall
Date: Mon Mar 3 13:20:40 2014
New Revision: 202741
URL: http://llvm.org/viewvc/llvm-project?rev=202741&view=rev
Log:
Implement LWG 2324: Insert iterator constructors should use addressof(). Add two new container classes to the test suite that overload operator &, and add test cases to the insert/front_insert/back_insert iterator tests that use these containers.
Added:
libcxx/trunk/test/support/nasty_containers.hpp
Modified:
libcxx/trunk/include/iterator
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/lv_value.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp
libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp
libcxx/trunk/www/cxx1y_status.html
Modified: libcxx/trunk/include/iterator
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/include/iterator (original)
+++ libcxx/trunk/include/iterator Mon Mar 3 13:20:40 2014
@@ -657,7 +657,7 @@ protected:
public:
typedef _Container container_type;
- _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
+ _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_back(__value_); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -690,7 +690,7 @@ protected:
public:
typedef _Container container_type;
- _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
+ _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_front(__value_); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -725,7 +725,7 @@ public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
- : container(&__x), iter(__i) {}
+ : container(_VSTD::addressof(__x)), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_)
{iter = container->insert(iter, __value_); ++iter; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.cons/container.pass.cpp Mon Mar 3 13:20:40 2014
@@ -15,6 +15,7 @@
#include <iterator>
#include <vector>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -26,4 +27,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op%2B%2B/post.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/post.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <vector>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -31,4 +32,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op%2B%2B/pre.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op++/pre.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <vector>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -29,4 +30,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op_astrk/test.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <vector>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -29,4 +30,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.inserter/test.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <vector>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -30,4 +31,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.cons/container.pass.cpp Mon Mar 3 13:20:40 2014
@@ -15,6 +15,7 @@
#include <iterator>
#include <list>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -26,4 +27,5 @@ test(C c)
int main()
{
test(std::list<int>());
+ test(nasty_list<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op%2B%2B/post.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/post.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <list>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -31,4 +32,5 @@ test(C c)
int main()
{
test(std::list<int>());
+ test(nasty_list<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op%2B%2B/pre.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op++/pre.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <list>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -29,4 +30,5 @@ test(C c)
int main()
{
test(std::list<int>());
+ test(nasty_list<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op%3D/lv_value.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp Mon Mar 3 13:20:40 2014
@@ -17,6 +17,7 @@
#include <iterator>
#include <list>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -42,4 +43,5 @@ public:
int main()
{
test(std::list<Copyable>());
+ test(nasty_list<Copyable>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op_astrk/test.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <list>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -29,4 +30,5 @@ test(C c)
int main()
{
test(std::list<int>());
+ test(nasty_list<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.inserter/test.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <list>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -30,4 +31,5 @@ test(C c)
int main()
{
test(std::list<int>());
+ test(nasty_list<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.cons/test.pass.cpp Mon Mar 3 13:20:40 2014
@@ -15,6 +15,7 @@
#include <iterator>
#include <vector>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -26,4 +27,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op%2B%2B/post.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/post.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <vector>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -31,4 +32,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op%2B%2B/pre.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op++/pre.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <vector>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -29,4 +30,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/lv_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op%3D/lv_value.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/lv_value.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/lv_value.pass.cpp Mon Mar 3 13:20:40 2014
@@ -18,6 +18,7 @@
#include <iterator>
#include <vector>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -45,6 +46,7 @@ insert3at(C& c, typename C::iterator i,
int main()
{
+ {
typedef std::vector<int> C;
C c1;
for (int i = 0; i < 3; ++i)
@@ -61,4 +63,23 @@ int main()
c2 = c1;
insert3at(c2, c2.begin()+3, 'a', 'b', 'c');
test(c1, 3, 'a', 'b', 'c', c2);
+ }
+ {
+ typedef nasty_vector<int> C;
+ C c1;
+ for (int i = 0; i < 3; ++i)
+ c1.push_back(i);
+ C c2 = c1;
+ insert3at(c2, c2.begin(), 'a', 'b', 'c');
+ test(c1, 0, 'a', 'b', 'c', c2);
+ c2 = c1;
+ insert3at(c2, c2.begin()+1, 'a', 'b', 'c');
+ test(c1, 1, 'a', 'b', 'c', c2);
+ c2 = c1;
+ insert3at(c2, c2.begin()+2, 'a', 'b', 'c');
+ test(c1, 2, 'a', 'b', 'c', c2);
+ c2 = c1;
+ insert3at(c2, c2.begin()+3, 'a', 'b', 'c');
+ test(c1, 3, 'a', 'b', 'c', c2);
+ }
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op%3D/rv_value.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op=/rv_value.pass.cpp Mon Mar 3 13:20:40 2014
@@ -56,6 +56,7 @@ struct do_nothing
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ {
typedef std::unique_ptr<int, do_nothing> Ptr;
typedef std::vector<Ptr> C;
C c1;
@@ -91,5 +92,6 @@ int main()
c2.push_back(Ptr(x+i));
insert3at(c2, c2.begin()+3, Ptr(x+3), Ptr(x+4), Ptr(x+5));
test(std::move(c1), 3, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);
+ }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/insert.iter.op_astrk/test.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <vector>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -29,4 +30,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Modified: libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp (original)
+++ libcxx/trunk/test/iterators/predef.iterators/insert.iterators/insert.iter.ops/inserter/test.pass.cpp Mon Mar 3 13:20:40 2014
@@ -16,6 +16,7 @@
#include <iterator>
#include <vector>
#include <cassert>
+#include "nasty_containers.hpp"
template <class C>
void
@@ -30,4 +31,5 @@ test(C c)
int main()
{
test(std::vector<int>());
+ test(nasty_vector<int>());
}
Added: libcxx/trunk/test/support/nasty_containers.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/nasty_containers.hpp?rev=202741&view=auto
==============================================================================
--- libcxx/trunk/test/support/nasty_containers.hpp (added)
+++ libcxx/trunk/test/support/nasty_containers.hpp Mon Mar 3 13:20:40 2014
@@ -0,0 +1,282 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef NASTY_VECTOR_H
+#define NASTY_VECTOR_H
+
+#include <vector>
+#include <list>
+
+template <class T>
+class nasty_vector
+{
+public:
+ typedef typename std::vector<T> nested_container;
+ typedef typename nested_container::value_type value_type;
+ typedef typename nested_container::reference reference;
+ typedef typename nested_container::const_reference const_reference;
+ typedef typename nested_container::iterator iterator;
+ typedef typename nested_container::const_iterator const_iterator;
+
+ typedef typename nested_container::size_type size_type;
+ typedef typename nested_container::difference_type difference_type;
+ typedef typename nested_container::pointer pointer;
+ typedef typename nested_container::const_pointer const_pointer;
+
+ typedef typename nested_container::reverse_iterator reverse_iterator;
+ typedef typename nested_container::const_reverse_iterator const_reverse_iterator;
+
+ nasty_vector() : v_() {}
+ explicit nasty_vector(size_type n) : v_(n) {}
+ nasty_vector(size_type n, const value_type& value) : v_(n, value) {}
+ template <class InputIterator> nasty_vector(InputIterator first, InputIterator last) : v_(first, last) {}
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ nasty_vector(std::initializer_list<value_type> il) : v_(il) {}
+#endif
+ ~nasty_vector() {}
+
+ template <class InputIterator>
+ void assign(InputIterator first, InputIterator last) { v_.assign(first, last); }
+ void assign(size_type n, const value_type& u) { v_.assign(n, u); }
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ void assign(std::initializer_list<value_type> il) { v_.assign(il); }
+#endif
+
+ iterator begin() _NOEXCEPT { return v_.begin(); }
+ const_iterator begin() const _NOEXCEPT { return v_.begin(); }
+ iterator end() _NOEXCEPT { return v_.end(); }
+ const_iterator end() const _NOEXCEPT { return v_.end(); }
+
+ reverse_iterator rbegin() _NOEXCEPT { return v_.rbegin(); }
+ const_reverse_iterator rbegin() const _NOEXCEPT { return v_.rbegin(); }
+ reverse_iterator rend() _NOEXCEPT { return v_.rend(); }
+ const_reverse_iterator rend() const _NOEXCEPT { return v_.rend(); }
+
+ const_iterator cbegin() const _NOEXCEPT { return v_.cbegin(); }
+ const_iterator cend() const _NOEXCEPT { return v_.cend(); }
+ const_reverse_iterator crbegin() const _NOEXCEPT { return v_.crbegin(); }
+ const_reverse_iterator crend() const _NOEXCEPT { return v_.crend(); }
+
+ size_type size() const _NOEXCEPT { return v_.size(); }
+ size_type max_size() const _NOEXCEPT { return v_.max_size(); }
+ size_type capacity() const _NOEXCEPT { return v_.capacity(); }
+ bool empty() const _NOEXCEPT { return v_.empty(); }
+ void reserve(size_type n) { v_.reserve(n); };
+ void shrink_to_fit() _NOEXCEPT { v_.shrink_to_fit(); }
+
+ reference operator[](size_type n) { return v_[n]; }
+ const_reference operator[](size_type n) const { return v_[n]; }
+ reference at(size_type n) { return v_.at(n); }
+ const_reference at(size_type n) const { return v_.at(n); }
+
+ reference front() { return v_.front(); }
+ const_reference front() const { return v_.front(); }
+ reference back() { return v_.back(); }
+ const_reference back() const { return v_.back(); }
+
+ value_type* data() _NOEXCEPT { return v_.data(); }
+ const value_type* data() const _NOEXCEPT { return v_.data(); }
+
+ void push_back(const value_type& x) { v_.push_back(x); }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ void push_back(value_type&& x) { v_.push_back(std::forward<value_type&&>(x)); }
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+ template <class... Args>
+ void emplace_back(Args&&... args) { v_.emplace_back(std::forward<Args>(args)...); }
+#endif
+#endif
+ void pop_back() { v_.pop_back(); }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+ template <class... Args> iterator emplace(const_iterator pos, Args&&... args)
+ { return v_.emplace(pos, std::forward<Args>(args)...); }
+#endif
+#endif
+
+ iterator insert(const_iterator pos, const value_type& x) { return v_.insert(pos, x); }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ iterator insert(const_iterator pos, value_type&& x) { return v_.insert(pos, std::forward<value_type>(x)); }
+#endif
+ iterator insert(const_iterator pos, size_type n, const value_type& x) { return v_.insert(pos, n, x); }
+ template <class InputIterator>
+ iterator insert(const_iterator pos, InputIterator first, InputIterator last)
+ { return v_.insert(pos, first, last); }
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return v_.insert(pos, il); }
+#endif
+
+ iterator erase(const_iterator pos) { return v_.erase(pos); }
+ iterator erase(const_iterator first, const_iterator last) { return v_.erase(first, last); }
+
+ void clear() _NOEXCEPT { v_.clear(); }
+
+ void resize(size_type sz) { v_.resize(sz); }
+ void resize(size_type sz, const value_type& c) { v_.resize(sz, c); }
+
+ void swap(nasty_vector &nv) _NOEXCEPT_(std::__is_nothrow_swappable<nested_container>::value)
+ { v_.swap(nv.v_); }
+
+ nasty_vector *operator &() { return nullptr; } // nasty
+ const nasty_vector *operator &() const { return nullptr; } // nasty
+
+ nested_container v_;
+};
+
+template <class T>
+bool operator==(const nasty_vector<T>& x, const nasty_vector<T>& y) { return x.v_ == y.v_; }
+
+template <class T>
+class nasty_list
+{
+public:
+
+ typedef typename std::list<T> nested_container;
+ typedef typename nested_container::value_type value_type;
+ typedef typename nested_container::reference reference;
+ typedef typename nested_container::const_reference const_reference;
+ typedef typename nested_container::iterator iterator;
+ typedef typename nested_container::const_iterator const_iterator;
+
+ typedef typename nested_container::size_type size_type;
+ typedef typename nested_container::difference_type difference_type;
+ typedef typename nested_container::pointer pointer;
+ typedef typename nested_container::const_pointer const_pointer;
+
+ typedef typename nested_container::reverse_iterator reverse_iterator;
+ typedef typename nested_container::const_reverse_iterator const_reverse_iterator;
+
+ nasty_list() : l_() {}
+ explicit nasty_list(size_type n) : l_(n) {}
+ nasty_list(size_type n, const value_type& value) : l_(n,value) {}
+ template <class Iter>
+ nasty_list(Iter first, Iter last) : l_(first, last) {}
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ nasty_list(std::initializer_list<value_type> il) : l_(il) {}
+#endif
+
+ ~nasty_list() {}
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ nasty_list& operator=(std::initializer_list<value_type> il) { l_ = il; return *this; }
+#endif
+ template <class Iter>
+ void assign(Iter first, Iter last) { l_.assign(first, last); }
+ void assign(size_type n, const value_type& t) { l_.assign(n, t); }
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ void assign(std::initializer_list<value_type> il) { l_.assign(il); }
+#endif
+
+
+ iterator begin() _NOEXCEPT { return l_.begin(); }
+ const_iterator begin() const _NOEXCEPT { return l_.begin(); }
+ iterator end() _NOEXCEPT { return l_.end(); }
+ const_iterator end() const _NOEXCEPT { return l_.end(); }
+
+ reverse_iterator rbegin() _NOEXCEPT { return l_.rbegin(); }
+ const_reverse_iterator rbegin() const _NOEXCEPT { return l_.rbegin(); }
+ reverse_iterator rend() _NOEXCEPT { return l_.rend(); }
+ const_reverse_iterator rend() const _NOEXCEPT { return l_.rend(); }
+
+ const_iterator cbegin() const _NOEXCEPT { return l_.cbegin(); }
+ const_iterator cend() const _NOEXCEPT { return l_.cend(); }
+ const_reverse_iterator crbegin() const _NOEXCEPT { return l_.crbegin(); }
+ const_reverse_iterator crend() const _NOEXCEPT { return l_.crend(); }
+
+ reference front() { return l_.front(); }
+ const_reference front() const { return l_.front(); }
+ reference back() { return l_.back(); }
+ const_reference back() const { return l_.back(); }
+
+ size_type size() const _NOEXCEPT { return l_.size(); }
+ size_type max_size() const _NOEXCEPT { return l_.max_size(); }
+ bool empty() const _NOEXCEPT { return l_.empty(); }
+
+ void push_front(const value_type& x) { l_.push_front(x); }
+ void push_back(const value_type& x) { l_.push_back(x); }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ void push_back(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); }
+ void push_front(value_type&& x) { l_.push_back(std::forward<value_type&&>(x)); }
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+ template <class... Args>
+ void emplace_back(Args&&... args) { l_.emplace_back(std::forward<Args>(args)...); }
+ template <class... Args>
+ void emplace_front(Args&&... args) { l_.emplace_front(std::forward<Args>(args)...); }
+#endif
+#endif
+ void pop_front() { l_.pop_front(); }
+ void pop_back() { l_.pop_back(); }
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+ template <class... Args> iterator emplace(const_iterator pos, Args&&... args)
+ { return l_.emplace(pos, std::forward<Args>(args)...); }
+#endif
+#endif
+
+ iterator insert(const_iterator pos, const value_type& x) { return l_.insert(pos, x); }
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ iterator insert(const_iterator pos, value_type&& x) { return l_.insert(pos, std::forward<value_type>(x)); }
+#endif
+ iterator insert(const_iterator pos, size_type n, const value_type& x) { return l_.insert(pos, n, x); }
+ template <class InputIterator>
+ iterator insert(const_iterator pos, InputIterator first, InputIterator last)
+ { return l_.insert(pos, first, last); }
+
+#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ iterator insert(const_iterator pos, std::initializer_list<value_type> il) { return l_.insert(pos, il); }
+#endif
+
+ iterator erase(const_iterator pos) { return l_.erase(pos); }
+ iterator erase(const_iterator pos, const_iterator last) { return l_.erase(pos, last); }
+
+ void resize(size_type sz) { l_.resize(); }
+ void resize(size_type sz, const value_type& c) { l_.resize(c); }
+
+ void swap(nasty_list &nl) _NOEXCEPT_(std::__is_nothrow_swappable<nested_container>::value)
+ { l_.swap(nl.l_); }
+
+ void clear() _NOEXCEPT { l_.clear(); }
+
+// void splice(const_iterator position, list& x);
+// void splice(const_iterator position, list&& x);
+// void splice(const_iterator position, list& x, const_iterator i);
+// void splice(const_iterator position, list&& x, const_iterator i);
+// void splice(const_iterator position, list& x, const_iterator first,
+// const_iterator last);
+// void splice(const_iterator position, list&& x, const_iterator first,
+// const_iterator last);
+//
+// void remove(const value_type& value);
+// template <class Pred> void remove_if(Pred pred);
+// void unique();
+// template <class BinaryPredicate>
+// void unique(BinaryPredicate binary_pred);
+// void merge(list& x);
+// void merge(list&& x);
+// template <class Compare>
+// void merge(list& x, Compare comp);
+// template <class Compare>
+// void merge(list&& x, Compare comp);
+// void sort();
+// template <class Compare>
+// void sort(Compare comp);
+// void reverse() noexcept;
+
+ nasty_list *operator &() { return nullptr; } // nasty
+ const nasty_list *operator &() const { return nullptr; } // nasty
+
+ nested_container l_;
+};
+
+template <class T>
+bool operator==(const nasty_list<T>& x, const nasty_list<T>& y) { return x.l_ == y.l_; }
+
+#endif
Modified: libcxx/trunk/www/cxx1y_status.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1y_status.html?rev=202741&r1=202740&r2=202741&view=diff
==============================================================================
--- libcxx/trunk/www/cxx1y_status.html (original)
+++ libcxx/trunk/www/cxx1y_status.html Mon Mar 3 13:20:40 2014
@@ -99,7 +99,7 @@
<tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21chicago2013/FormalMotions/n3778.html">3778</a></td><td>CWG</td><td>Sized deallocation</td><td>Chicago</td><td></td><td></td></tr>
<tr><td></td><td></td><td></td><td></td><td></td><td></td></tr>
- <tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21issaquah/FormalMotions/N3924_rand-note-v2.pdf">3924</a></td><td>LWG</td><td>Discouraging rand() in C++14</td><td>Issaquah</td><td></td><td></td></tr>
+ <tr><td><a href="http://wiki.edg.com/twiki/pub/Wg21issaquah/FormalMotions/N3924_rand-note-v2.pdf">3924</a></td><td>LWG</td><td>Discouraging rand() in C++14</td><td>Issaquah</td><td></td><td>Complete</td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3887">3887</a></td><td>LWG</td><td>Consistent Metafunction Aliases</td><td>Issaquah</td><td></td><td>Complete</td></tr>
<!-- <tr><td></td><td></td><td></td><td></td><td></td><td></td></tr> -->
@@ -252,7 +252,7 @@
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2320">2320</a></td><td>select_on_container_copy_construction() takes allocators, not containers</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2322">2322</a></td><td>Associative(initializer_list, stuff) constructors are underspecified</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2323">2323</a></td><td>vector::resize(n, t)'s specification should be simplified</td><td>Issaquah</td><td>Complete</td></tr>
- <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2324">2324</a></td><td>Insert iterator constructors should use addressof()</td><td>Issaquah</td><td></td></tr>
+ <tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2324">2324</a></td><td>Insert iterator constructors should use addressof()</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2329">2329</a></td><td>regex_match()/regex_search() with match_results should forbid temporary strings</td><td>Issaquah</td><td>Complete</td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2330">2330</a></td><td>regex("meow", regex::icase) is technically forbidden but should be permitted</td><td>Issaquah</td><td></td></tr>
<tr><td><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2332">2332</a></td><td>regex_iterator/regex_token_iterator should forbid temporary regexes</td><td>Issaquah</td><td>Complete</td></tr>
More information about the cfe-commits
mailing list