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 "test_macros.h" 18 #include "min_allocator.h" 19 main(int,char **)20int main(int, char**) 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 return 0; 56 } 57