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 //===----------------------------------------------------------------------===//
13 // template <class... Args> void emplace(const_iterator p, Args&&... args);
19 #include "test_macros.h"
20 #include "min_allocator.h"
28 A
& operator=(const A
&);
33 int geti() const {return i_
;}
34 double getd() const {return d_
;}
41 c
.emplace(c
.cbegin(), 2, 3.5);
42 assert(c
.size() == 1);
43 assert(c
.front().geti() == 2);
44 assert(c
.front().getd() == 3.5);
45 c
.emplace(c
.cend(), 3, 4.5);
46 assert(c
.size() == 2);
47 assert(c
.front().geti() == 2);
48 assert(c
.front().getd() == 3.5);
49 assert(c
.back().geti() == 3);
50 assert(c
.back().getd() == 4.5);
53 std::list
<A
, min_allocator
<A
>> c
;
54 c
.emplace(c
.cbegin(), 2, 3.5);
55 assert(c
.size() == 1);
56 assert(c
.front().geti() == 2);
57 assert(c
.front().getd() == 3.5);
58 c
.emplace(c
.cend(), 3, 4.5);
59 assert(c
.size() == 2);
60 assert(c
.front().geti() == 2);
61 assert(c
.front().getd() == 3.5);
62 assert(c
.back().geti() == 3);
63 assert(c
.back().getd() == 4.5);