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 Alloc>
12 //     explicit priority_queue(const Alloc& a);
13 
14 #include <queue>
15 #include <cassert>
16 
17 #include "test_macros.h"
18 #include "test_allocator.h"
19 
20 template <class T>
21 struct test
22     : public std::priority_queue<T, std::vector<T, test_allocator<T> > >
23 {
24     typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
25     typedef typename base::container_type container_type;
26     typedef typename base::value_compare value_compare;
27 
testtest28     explicit test(const test_allocator<int>& a) : base(a) {}
testtest29     test(const value_compare& comp, const test_allocator<int>& a)
30         : base(comp, c, a) {}
testtest31     test(const value_compare& comp, const container_type& container,
32         const test_allocator<int>& a) : base(comp, container, a) {}
33 #if TEST_STD_VER >= 11
testtest34     test(const value_compare& comp, container_type&& container,
35          const test_allocator<int>& a) : base(comp, std::move(container), a) {}
testtest36     test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
37 #endif
get_allocatortest38     test_allocator<int> get_allocator() {return c.get_allocator();}
39 
40     using base::c;
41 };
42 
main(int,char **)43 int main(int, char**)
44 {
45     test<int> q((test_allocator<int>(3)));
46     assert(q.c.get_allocator() == test_allocator<int>(3));
47     assert(q.c.size() == 0);
48 
49   return 0;
50 }
51