Home | History | Annotate | Download | only in deque.cons
      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <deque>
     11 
     12 // deque(const deque& c, const allocator_type& a);
     13 
     14 #include <deque>
     15 #include <cassert>
     16 
     17 #include "test_allocator.h"
     18 #include "min_allocator.h"
     19 
     20 template <class C>
     21 void
     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 
     29 int main()
     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 __cplusplus >= 201103L
     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