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 // vector<bool>
12 
13 // vector(const Alloc& = Alloc());
14 
15 #include <vector>
16 #include <cassert>
17 
18 #include "test_allocator.h"
19 #include "min_allocator.h"
20 
21 template <class C>
22 void
test0()23 test0()
24 {
25     C c;
26     assert(c.__invariants());
27     assert(c.empty());
28     assert(c.get_allocator() == typename C::allocator_type());
29 #if __cplusplus >= 201103L
30     C c1 = {};
31     assert(c1.__invariants());
32     assert(c1.empty());
33     assert(c1.get_allocator() == typename C::allocator_type());
34 #endif
35 }
36 
37 template <class C>
38 void
test1(const typename C::allocator_type & a)39 test1(const typename C::allocator_type& a)
40 {
41     C c(a);
42     assert(c.__invariants());
43     assert(c.empty());
44     assert(c.get_allocator() == a);
45 }
46 
main()47 int main()
48 {
49     {
50     test0<std::vector<bool> >();
51     test1<std::vector<bool, test_allocator<bool> > >(test_allocator<bool>(3));
52     }
53 #if __cplusplus >= 201103L
54     {
55     test0<std::vector<bool, min_allocator<bool>> >();
56     test1<std::vector<bool, min_allocator<bool> > >(min_allocator<bool>());
57     }
58 #endif
59 }
60