xref: /llvm-project/libcxx/test/std/containers/container.adaptors/queue/queue.cons.alloc/ctor_alloc.pass.cpp (revision c479e0c99459e4c5596c2a22829d0937224df0bf)
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 queue(const Alloc& a);
13 
14 #include <queue>
15 #include <cassert>
16 
17 #include "test_macros.h"
18 #include "test_allocator.h"
19 
20 struct test
21     : private std::queue<int, std::deque<int, test_allocator<int> > >
22 {
23     typedef std::queue<int, std::deque<int, test_allocator<int> > > base;
24 
testtest25     explicit test(const test_allocator<int>& a) : base(a) {}
testtest26     test(const container_type& container, const test_allocator<int>& a) : base(container, a) {}
27 #if TEST_STD_VER >= 11
testtest28     test(container_type&& container, const test_allocator<int>& a) : base(std::move(container), a) {}
testtest29     test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
30 #endif
get_allocatortest31     test_allocator<int> get_allocator() {return c.get_allocator();}
32 };
33 
main(int,char **)34 int main(int, char**)
35 {
36     test q(test_allocator<int>(3));
37     assert(q.get_allocator() == test_allocator<int>(3));
38 
39   return 0;
40 }
41