| 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... |
| 33 | static_assert(std::is_constructible<std::vector<int>, int*, int*>::value, "" ); |
| 34 | static_assert(std::is_constructible<std::vector<int>, int, int >::value, "" ); |
| 35 | |
| 36 | // ...but std::priority_queue is not. |
| 37 | static_assert(std::is_constructible<std::priority_queue<int>, int*, int*>::value, "" ); |
| 38 | static_assert(!std::is_constructible<std::priority_queue<int>, int, int >::value, "" ); |
| 39 | |
| 40 | static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>>::value, "" ); |
| 41 | static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>>::value, "" ); |
| 42 | |
| 43 | static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>>::value, "" ); |
| 44 | static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>>::value, "" ); |
| 45 | |
| 46 | static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>&>::value, |
| 47 | "" ); |
| 48 | static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>&>::value, "" ); |
| 49 | |
| 50 | static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::allocator<int>>::value, "" ); |
| 51 | static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::allocator<int>>::value, "" ); |
| 52 | |
| 53 | static_assert(std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::allocator<int>>::value, |
| 54 | "" ); |
| 55 | static_assert(!std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::allocator<int>>::value, |
| 56 | "" ); |
| 57 | |
| 58 | static_assert( |
| 59 | std::is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>, std::allocator<int>>:: |
| 60 | value, |
| 61 | "" ); |
| 62 | static_assert( |
| 63 | !std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>, std::allocator<int>>:: |
| 64 | value, |
| 65 | "" ); |
| 66 | |
| 67 | static_assert( |
| 68 | std:: |
| 69 | is_constructible<std::priority_queue<int>, int*, int*, std::less<int>, std::vector<int>&, std::allocator<int>>:: |
| 70 | value, |
| 71 | "" ); |
| 72 | static_assert( |
| 73 | !std::is_constructible<std::priority_queue<int>, int, int, std::less<int>, std::vector<int>&, std::allocator<int>>:: |
| 74 | value, |
| 75 | "" ); |
| 76 | |