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