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// template <class InputIterator>
14// priority_queue(InputIterator first, InputIterator last, const Compare& = Compare());
15// template <class InputIterator>
16// priority_queue(InputIterator first, InputIterator last, const Compare&, const Container&);
17// template <class InputIterator>
18// priority_queue(InputIterator first, InputIterator last, const Compare&, Container&&);
19// template <class InputIterator>
20// priority_queue(InputIterator first, InputIterator last, const Alloc&);
21// template <class InputIterator>
22// priority_queue(InputIterator first, InputIterator last, const Compare&, const Alloc&);
23// template <class InputIterator>
24// priority_queue(InputIterator first, InputIterator last, const Compare&, const Container&, const Alloc&);
25// template <class InputIterator>
26// priority_queue(InputIterator first, InputIterator last, const Compare&, Container&&, const Alloc&);
27
28#include <queue>
29#include <type_traits>
30#include <vector>
31
32// Sanity-check that std::vector is constructible from two ints...
33static_assert(std::is_constructible<std::vector<int>, int*, int*>::value, "");
34static_assert(std::is_constructible<std::vector<int>, int, int >::value, "");
35
36// ...but std::priority_queue is not.
37static_assert(std::is_constructible<std::priority_queue<int>, int*, int*>::value, "");
38static_assert(!std::is_constructible<std::priority_queue<int>, int, int >::value, "");
39
40static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>>::value, "");
41static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>>::value, "");
42
43static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>>::value, "");
44static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>>::value, "");
45
46static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>&>::value,
47 "");
48static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>&>::value, "");
49
50static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::allocator<int>>::value, "");
51static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::allocator<int>>::value, "");
52
53static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::allocator<int>>::value,
54 "");
55static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::allocator<int>>::value,
56 "");
57
58static_assert(
59 std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>, std::allocator<int>>::
60 value,
61 "");
62static_assert(
63 !std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>, std::allocator<int>>::
64 value,
65 "");
66
67static_assert(
68 std::
69 is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>&, std::allocator<int>>::
70 value,
71 "");
72static_assert(
73 !std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>&, std::allocator<int>>::
74 value,
75 "");
76

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