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(priority_queue&& q);
14
15#include <queue>
16#include <cassert>
17
18#include "test_macros.h"
19#include "MoveOnly.h"
20
21template <class C>
22TEST_CONSTEXPR_CXX26 C make(int n) {
23 C c;
24 for (int i = 0; i < n; ++i)
25 c.push_back(MoveOnly(i));
26 return c;
27}
28
29TEST_CONSTEXPR_CXX26 bool test() {
30 std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
31 std::priority_queue<MoveOnly> q = std::move(qo);
32 assert(q.size() == 5);
33 assert(q.top() == MoveOnly(4));
34
35 return true;
36}
37
38int main(int, char**) {
39 assert(test());
40#if TEST_STD_VER >= 26
41 static_assert(test());
42#endif
43
44 return 0;
45}

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