1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++98, c++03, c++11
13 // template <class... Args> iterator emplace(const_iterator pos, Args&&... args);
17 #include "test_macros.h"
18 #include "min_allocator.h"
23 typedef std::vector
<bool> C
;
26 C::iterator i
= c
.emplace(c
.cbegin());
27 assert(i
== c
.begin());
28 assert(c
.size() == 1);
29 assert(c
.front() == false);
31 i
= c
.emplace(c
.cend(), true);
32 assert(i
== c
.end()-1);
33 assert(c
.size() == 2);
34 assert(c
.front() == false);
35 assert(c
.back() == true);
37 i
= c
.emplace(c
.cbegin()+1, true);
38 assert(i
== c
.begin()+1);
39 assert(c
.size() == 3);
40 assert(c
.front() == false);
42 assert(c
.back() == true);
45 typedef std::vector
<bool, min_allocator
<bool>> C
;
48 C::iterator i
= c
.emplace(c
.cbegin());
49 assert(i
== c
.begin());
50 assert(c
.size() == 1);
51 assert(c
.front() == false);
53 i
= c
.emplace(c
.cend(), true);
54 assert(i
== c
.end()-1);
55 assert(c
.size() == 2);
56 assert(c
.front() == false);
57 assert(c
.back() == true);
59 i
= c
.emplace(c
.cbegin()+1, true);
60 assert(i
== c
.begin()+1);
61 assert(c
.size() == 3);
62 assert(c
.size() == 3);
63 assert(c
.front() == false);
65 assert(c
.back() == true);