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 // <deque>
10 
11 // deque(const deque& c, const allocator_type& a);
12 
13 #include <deque>
14 #include <cassert>
15 
16 #include "test_allocator.h"
17 #include "min_allocator.h"
18 
19 template <class C>
20 void
21 test(const C& x, const typename C::allocator_type& a)
22 {
23     C c(x, a);
24     assert(c == x);
25     assert(c.get_allocator() == a);
26 }
27 
28 int main(int, char**)
29 {
30     {
31         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
32         int* an = ab + sizeof(ab)/sizeof(ab[0]);
33         test(std::deque<int, test_allocator<int> >(ab, an, test_allocator<int>(3)),
34                                                            test_allocator<int>(4));
35     }
36     {
37         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
38         int* an = ab + sizeof(ab)/sizeof(ab[0]);
39         test(std::deque<int, other_allocator<int> >(ab, an, other_allocator<int>(3)),
40                                                             other_allocator<int>(4));
41     }
42 #if TEST_STD_VER >= 11
43     {
44         int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45};
45         int* an = ab + sizeof(ab)/sizeof(ab[0]);
46         test(std::deque<int, min_allocator<int> >(ab, an, min_allocator<int>()),
47                                                           min_allocator<int>());
48     }
49 #endif
50 
51   return 0;
52 }
53