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 push_back(const value_type& x); 13 14 #include <vector> 15 #include <cassert> 16 #include <cstddef> 17 18 #include "min_allocator.h" 19 20 int main(int, char**) 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 (std::size_t j = 0; j < c.size(); ++j) 31 assert(c[j] == a[j]); 32 } 33 } 34 #if TEST_STD_VER >= 11 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 (std::size_t j = 0; j < c.size(); ++j) 44 assert(c[j] == a[j]); 45 } 46 } 47 #endif 48 49 return 0; 50 } 51