xref: /llvm-project/libcxx/test/std/containers/container.adaptors/stack/stack.defn/push_rv.pass.cpp (revision 31cbe0f240f660f15602c96b787c58a26f17e179)
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 // <stack>
12 
13 // void push(value_type&& v);
14 
15 #include <stack>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 #include "MoveOnly.h"
20 
main(int,char **)21 int main(int, char**)
22 {
23     std::stack<MoveOnly> q;
24     q.push(MoveOnly(1));
25     assert(q.size() == 1);
26     assert(q.top() == MoveOnly(1));
27     q.push(MoveOnly(2));
28     assert(q.size() == 2);
29     assert(q.top() == MoveOnly(2));
30     q.push(MoveOnly(3));
31     assert(q.size() == 3);
32     assert(q.top() == MoveOnly(3));
33 
34   return 0;
35 }
36