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