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, c++11, c++14, c++17, c++20
10
11 // <queue>
12
13 // template <class InputIterator>
14 // queue(InputIterator, InputIterator);
15
16 #include <cassert>
17 #include <queue>
18 #include <type_traits>
19
20 #include "test_allocator.h"
21
22 static_assert(!std::is_constructible_v<std::queue<int>, int, int, std::allocator<int>>);
23 static_assert(!std::is_constructible_v<std::queue<int>, int*, int*, int>);
24 static_assert( std::is_constructible_v<std::queue<int, std::deque<int, test_allocator<int>>>, int*, int*, test_allocator<int>>);
25 static_assert(!std::is_constructible_v<std::queue<int, std::deque<int, test_allocator<int>>>, int*, int*, std::allocator<int>>);
26
27 struct alloc : test_allocator<int> {
28 alloc(test_allocator_statistics* a);
29 };
30 static_assert( std::is_constructible_v<std::queue<int, std::deque<int, alloc>>, int*, int*, test_allocator_statistics*>);
31
main(int,char **)32 int main(int, char**) {
33 const int a[] = {4, 3, 2, 1};
34 std::queue<int> queue(a, a + 4);
35 assert(queue.front() == 4);
36 queue.pop();
37 assert(queue.front() == 3);
38 queue.pop();
39 assert(queue.front() == 2);
40 queue.pop();
41 assert(queue.front() == 1);
42 queue.pop();
43 assert(queue.empty());
44
45 return 0;
46 }
47