1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: c++98, c++03
16 // requires CopyConstructible<Cont::value_type>
17 // insert_iterator<Cont>&
18 // operator=(const Cont::value_type& value);
29 test(C c1, typename C::difference_type j,
30 typename C::value_type x1, typename C::value_type x2,
31 typename C::value_type x3, const C& c2)
33 std::insert_iterator<C> q(c1, c1.begin() + j);
42 insert3at(C& c, typename C::iterator i,
43 typename C::value_type x1, typename C::value_type x2,
44 typename C::value_type x3)
46 i = c.insert(i, std::move(x1));
47 i = c.insert(++i, std::move(x2));
48 c.insert(++i, std::move(x3));
53 void operator()(void*) const {}
59 typedef std::unique_ptr<int, do_nothing> Ptr;
60 typedef std::vector<Ptr> C;
63 for (int i = 0; i < 3; ++i)
64 c1.push_back(Ptr(x+i));
66 for (int i = 0; i < 3; ++i)
67 c2.push_back(Ptr(x+i));
68 insert3at(c2, c2.begin(), Ptr(x+3), Ptr(x+4), Ptr(x+5));
69 test(std::move(c1), 0, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);
71 for (int i = 0; i < 3; ++i)
72 c1.push_back(Ptr(x+i));
74 for (int i = 0; i < 3; ++i)
75 c2.push_back(Ptr(x+i));
76 insert3at(c2, c2.begin()+1, Ptr(x+3), Ptr(x+4), Ptr(x+5));
77 test(std::move(c1), 1, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);
79 for (int i = 0; i < 3; ++i)
80 c1.push_back(Ptr(x+i));
82 for (int i = 0; i < 3; ++i)
83 c2.push_back(Ptr(x+i));
84 insert3at(c2, c2.begin()+2, Ptr(x+3), Ptr(x+4), Ptr(x+5));
85 test(std::move(c1), 2, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);
87 for (int i = 0; i < 3; ++i)
88 c1.push_back(Ptr(x+i));
90 for (int i = 0; i < 3; ++i)
91 c2.push_back(Ptr(x+i));
92 insert3at(c2, c2.begin()+3, Ptr(x+3), Ptr(x+4), Ptr(x+5));
93 test(std::move(c1), 3, Ptr(x+3), Ptr(x+4), Ptr(x+5), c2);