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_front(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
22int main(int, char**)
23{
24 {
25 std::list<MoveOnly> l1;
26 l1.push_front(MoveOnly(1));
27 assert(l1.size() == 1);
28 assert(l1.front() == MoveOnly(1));
29 l1.push_front(MoveOnly(2));
30 assert(l1.size() == 2);
31 assert(l1.front() == MoveOnly(2));
32 assert(l1.back() == MoveOnly(1));
33 }
34 {
35 std::list<MoveOnly, min_allocator<MoveOnly>> l1;
36 l1.push_front(MoveOnly(1));
37 assert(l1.size() == 1);
38 assert(l1.front() == MoveOnly(1));
39 l1.push_front(MoveOnly(2));
40 assert(l1.size() == 2);
41 assert(l1.front() == MoveOnly(2));
42 assert(l1.back() == MoveOnly(1));
43 }
44
45 return 0;
46}
47

source code of libcxx/test/std/containers/sequences/list/list.modifiers/push_front_rvalue.pass.cpp