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 12 // size_type capacity() const; 13 14 #include <vector> 15 #include <cassert> 16 17 #include "min_allocator.h" 18 19 int main() 20 { 21 { 22 std::vector<int> v; 23 assert(v.capacity() == 0); 24 } 25 { 26 std::vector<int> v(100); 27 assert(v.capacity() == 100); 28 v.push_back(0); 29 assert(v.capacity() > 101); 30 } 31 #if __cplusplus >= 201103L 32 { 33 std::vector<int, min_allocator<int>> v; 34 assert(v.capacity() == 0); 35 } 36 { 37 std::vector<int, min_allocator<int>> v(100); 38 assert(v.capacity() == 100); 39 v.push_back(0); 40 assert(v.capacity() > 101); 41 } 42 #endif 43 } 44