1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <vector> 10 // vector<bool> 11 12 // void reserve(size_type n); 13 14 #include <vector> 15 #include <cassert> 16 17 #include "min_allocator.h" 18 19 int main(int, char**) 20 { 21 { 22 std::vector<bool> v; 23 v.reserve(10); 24 assert(v.capacity() >= 10); 25 } 26 { 27 std::vector<bool> v(100); 28 assert(v.capacity() >= 100); 29 v.reserve(50); 30 assert(v.size() == 100); 31 assert(v.capacity() >= 100); 32 v.reserve(150); 33 assert(v.size() == 100); 34 assert(v.capacity() >= 150); 35 } 36 #if TEST_STD_VER >= 11 37 { 38 std::vector<bool, min_allocator<bool>> v; 39 v.reserve(10); 40 assert(v.capacity() >= 10); 41 } 42 { 43 std::vector<bool, min_allocator<bool>> v(100); 44 assert(v.capacity() >= 100); 45 v.reserve(50); 46 assert(v.size() == 100); 47 assert(v.capacity() >= 100); 48 v.reserve(150); 49 assert(v.size() == 100); 50 assert(v.capacity() >= 150); 51 } 52 #endif 53 54 return 0; 55 } 56