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

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