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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202741 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2014-03-03 19:20:40 +00:00
parent 0c60b0a686
commit 53c0e72d5c
21 changed files with 342 additions and 5 deletions

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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>());
}

View File

@@ -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);
}
}

View File

@@ -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
}

View File

@@ -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>());
}

View File

@@ -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>());
}