Home | History | Annotate | Download | only in vector.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 // UNSUPPORTED: c++98, c++03
     11 
     12 // <vector>
     13 
     14 // vector(initializer_list<value_type> il, const Allocator& a = allocator_type());
     15 
     16 #include <vector>
     17 #include <cassert>
     18 
     19 #include "test_allocator.h"
     20 #include "min_allocator.h"
     21 #include "asan_testing.h"
     22 
     23 int main()
     24 {
     25     {
     26     std::vector<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3));
     27     assert(d.get_allocator() == test_allocator<int>(3));
     28     assert(d.size() == 4);
     29     assert(is_contiguous_container_asan_correct(d));
     30     assert(d[0] == 3);
     31     assert(d[1] == 4);
     32     assert(d[2] == 5);
     33     assert(d[3] == 6);
     34     }
     35     {
     36     std::vector<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>());
     37     assert(d.get_allocator() == min_allocator<int>());
     38     assert(d.size() == 4);
     39     assert(is_contiguous_container_asan_correct(d));
     40     assert(d[0] == 3);
     41     assert(d[1] == 4);
     42     assert(d[2] == 5);
     43     assert(d[3] == 6);
     44     }
     45 }
     46