1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++98, c++03, c++11
10 // <vector>
11 //  vector<bool>
12 
13 // template <class... Args> iterator emplace(const_iterator pos, Args&&... args);
14 
15 #include <vector>
16 #include <cassert>
17 #include "min_allocator.h"
18 
19 int main(int, char**)
20 {
21     {
22         typedef std::vector<bool> C;
23         C c;
24 
25         C::iterator i = c.emplace(c.cbegin());
26         assert(i == c.begin());
27         assert(c.size() == 1);
28         assert(c.front() == false);
29 
30         i = c.emplace(c.cend(), true);
31         assert(i == c.end()-1);
32         assert(c.size() == 2);
33         assert(c.front() == false);
34         assert(c.back() == true);
35 
36         i = c.emplace(c.cbegin()+1, true);
37         assert(i == c.begin()+1);
38         assert(c.size() == 3);
39         assert(c.front() == false);
40         assert(c[1] == true);
41         assert(c.back() == true);
42     }
43     {
44         typedef std::vector<bool, min_allocator<bool>> C;
45         C c;
46 
47         C::iterator i = c.emplace(c.cbegin());
48         assert(i == c.begin());
49         assert(c.size() == 1);
50         assert(c.front() == false);
51 
52         i = c.emplace(c.cend(), true);
53         assert(i == c.end()-1);
54         assert(c.size() == 2);
55         assert(c.front() == false);
56         assert(c.back() == true);
57 
58         i = c.emplace(c.cbegin()+1, true);
59         assert(i == c.begin()+1);
60         assert(c.size() == 3);
61         assert(c.size() == 3);
62         assert(c.front() == false);
63         assert(c[1] == true);
64         assert(c.back() == true);
65     }
66 
67   return 0;
68 }
69