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// <queue>
12
13// priority_queue();
14
15// void push(value_type&& v);
16
17#include <queue>
18#include <cassert>
19
20#include "test_macros.h"
21#include "MoveOnly.h"
22
23TEST_CONSTEXPR_CXX26 bool test() {
24 std::priority_queue<MoveOnly> q;
25 q.push(1);
26 assert(q.top() == 1);
27 q.push(3);
28 assert(q.top() == 3);
29 q.push(2);
30 assert(q.top() == 3);
31
32 return true;
33}
34
35int main(int, char**) {
36 assert(test());
37#if TEST_STD_VER >= 26
38 static_assert(test());
39#endif
40
41 return 0;
42}
43

source code of libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp