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 push_back(const value_type& x); 14 15 #include <vector> 16 #include <cassert> 17 18 #include "../../min_allocator.h" 19 20 int main() 21 { 22 { 23 bool a[] = {0, 1, 1, 0, 1, 0, 0}; 24 const unsigned N = sizeof(a)/sizeof(a[0]); 25 std::vector<bool> c; 26 for (unsigned i = 0; i < N; ++i) 27 { 28 c.push_back(a[i]); 29 assert(c.size() == i+1); 30 for (int j = 0; j < c.size(); ++j) 31 assert(c[j] == a[j]); 32 } 33 } 34 #if __cplusplus >= 201103L 35 { 36 bool a[] = {0, 1, 1, 0, 1, 0, 0}; 37 const unsigned N = sizeof(a)/sizeof(a[0]); 38 std::vector<bool, min_allocator<bool>> c; 39 for (unsigned i = 0; i < N; ++i) 40 { 41 c.push_back(a[i]); 42 assert(c.size() == i+1); 43 for (int j = 0; j < c.size(); ++j) 44 assert(c[j] == a[j]); 45 } 46 } 47 #endif 48 } 49