Home | History | Annotate | Download | only in vector.bool
      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 #include <cstddef>
     18 
     19 #include "min_allocator.h"
     20 
     21 int main()
     22 {
     23     {
     24         bool a[] = {0, 1, 1, 0, 1, 0, 0};
     25         const unsigned N = sizeof(a)/sizeof(a[0]);
     26         std::vector<bool> c;
     27         for (unsigned i = 0; i < N; ++i)
     28         {
     29             c.push_back(a[i]);
     30             assert(c.size() == i+1);
     31             for (std::size_t j = 0; j < c.size(); ++j)
     32                 assert(c[j] == a[j]);
     33         }
     34     }
     35 #if TEST_STD_VER >= 11
     36     {
     37         bool a[] = {0, 1, 1, 0, 1, 0, 0};
     38         const unsigned N = sizeof(a)/sizeof(a[0]);
     39         std::vector<bool, min_allocator<bool>> c;
     40         for (unsigned i = 0; i < N; ++i)
     41         {
     42             c.push_back(a[i]);
     43             assert(c.size() == i+1);
     44             for (std::size_t j = 0; j < c.size(); ++j)
     45                 assert(c[j] == a[j]);
     46         }
     47     }
     48 #endif
     49 }
     50