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& operator=(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;
31 q = qo;
32 assert(q.size() == 5);
33 assert(q.top() == 0);
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}
46

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