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++03 |
10 | |
11 | // <list> |
12 | |
13 | // void push_back(value_type&& x); |
14 | |
15 | #include <list> |
16 | #include <cassert> |
17 | |
18 | #include "test_macros.h" |
19 | #include "MoveOnly.h" |
20 | #include "min_allocator.h" |
21 | |
22 | int main(int, char**) { |
23 | { |
24 | std::list<MoveOnly> l1; |
25 | l1.push_back(MoveOnly(1)); |
26 | assert(l1.size() == 1); |
27 | assert(l1.front() == MoveOnly(1)); |
28 | l1.push_back(MoveOnly(2)); |
29 | assert(l1.size() == 2); |
30 | assert(l1.front() == MoveOnly(1)); |
31 | assert(l1.back() == MoveOnly(2)); |
32 | } |
33 | { |
34 | std::list<MoveOnly, min_allocator<MoveOnly>> l1; |
35 | l1.push_back(MoveOnly(1)); |
36 | assert(l1.size() == 1); |
37 | assert(l1.front() == MoveOnly(1)); |
38 | l1.push_back(MoveOnly(2)); |
39 | assert(l1.size() == 2); |
40 | assert(l1.front() == MoveOnly(1)); |
41 | assert(l1.back() == MoveOnly(2)); |
42 | } |
43 | |
44 | return 0; |
45 | } |
46 | |