• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // void reserve(size_type n);
14 
15 #include <vector>
16 #include <cassert>
17 
18 #include "min_allocator.h"
19 
main()20 int main()
21 {
22     {
23         std::vector<bool> v;
24         v.reserve(10);
25         assert(v.capacity() >= 10);
26     }
27     {
28         std::vector<bool> v(100);
29         assert(v.capacity() >= 100);
30         v.reserve(50);
31         assert(v.size() == 100);
32         assert(v.capacity() >= 100);
33         v.reserve(150);
34         assert(v.size() == 100);
35         assert(v.capacity() >= 150);
36     }
37 #if TEST_STD_VER >= 11
38     {
39         std::vector<bool, min_allocator<bool>> v;
40         v.reserve(10);
41         assert(v.capacity() >= 10);
42     }
43     {
44         std::vector<bool, min_allocator<bool>> v(100);
45         assert(v.capacity() >= 100);
46         v.reserve(50);
47         assert(v.size() == 100);
48         assert(v.capacity() >= 100);
49         v.reserve(150);
50         assert(v.size() == 100);
51         assert(v.capacity() >= 150);
52     }
53 #endif
54 }
55