Debian Codegraph @

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

raw
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
19 template <class C>
20 C
21 make(int n)
22 {
23 C c;
24 for (int i = 0; i < n; ++i)
25 c.push_back(i);
26 return c;
27 }
28
29 int main(int, char**)
30 {
31 std::vector<int> v = make<std::vector<int> >(5);
32 std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
33 std::priority_queue<int, std::vector<int>, std::greater<int> > q;
34 q = qo;
35 assert(q.size() == 5);
36 assert(q.top() == 0);
37
38 return 0;
39 }