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// template <class InputIterator>
12// priority_queue(InputIterator first, InputIterator last);
13
14#include <queue>
15#include <cassert>
16#include <cstddef>
17
18#include "test_macros.h"
19
20TEST_CONSTEXPR_CXX26 bool test() {
21 int a[] = {3, 5, 2, 0, 6, 8, 1};
22 int* an = a + sizeof(a) / sizeof(a[0]);
23 std::priority_queue<int> q(a, an);
24 assert(q.size() == static_cast<std::size_t>(an - a));
25 assert(q.top() == 8);
26
27 return true;
28}
29
30int main(int, char**) {
31 assert(test());
32#if TEST_STD_VER >= 26
33 static_assert(test());
34#endif
35
36 return 0;
37}
38

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