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 resize(size_type sz); 14 15#include <vector> 16#include <cassert> 17 18#include "min_allocator.h" 19 20int main() 21{ 22 { 23 std::vector<bool> v(100); 24 v.resize(50); 25 assert(v.size() == 50); 26 assert(v.capacity() >= 100); 27 v.resize(200); 28 assert(v.size() == 200); 29 assert(v.capacity() >= 200); 30 v.reserve(400); 31 v.resize(300); // check the case when resizing and we already have room 32 assert(v.size() == 300); 33 assert(v.capacity() >= 400); 34 } 35#if __cplusplus >= 201103L 36 { 37 std::vector<bool, min_allocator<bool>> v(100); 38 v.resize(50); 39 assert(v.size() == 50); 40 assert(v.capacity() >= 100); 41 v.resize(200); 42 assert(v.size() == 200); 43 assert(v.capacity() >= 200); 44 v.reserve(400); 45 v.resize(300); // check the case when resizing and we already have room 46 assert(v.size() == 300); 47 assert(v.capacity() >= 400); 48 } 49#endif 50} 51