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 // <vector>
     11 
     12 // vector(size_type n, const value_type& x);
     13 
     14 #include <vector>
     15 #include <cassert>
     16 
     17 #include "../../../stack_allocator.h"
     18 #include "../../../min_allocator.h"
     19 
     20 template <class C>
     21 void
     22 test(typename C::size_type n, const typename C::value_type& x)
     23 {
     24     C c(n, x);
     25     assert(c.__invariants());
     26     assert(c.size() == n);
     27     for (typename C::const_iterator i = c.cbegin(), e = c.cend(); i != e; ++i)
     28         assert(*i == x);
     29 }
     30 
     31 int main()
     32 {
     33     test<std::vector<int> >(50, 3);
     34     test<std::vector<int, stack_allocator<int, 50> > >(50, 5);
     35 #if __cplusplus >= 201103L
     36     test<std::vector<int, min_allocator<int>> >(50, 3);
     37 #endif
     38 }
     39