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 // static void swap(reference x, reference y) noexcept;
     14 
     15 #include <vector>
     16 #include <cassert>
     17 
     18 #include "test_macros.h"
     19 
     20 int main()
     21 {
     22 
     23     bool a[] = {false, true, false, true};
     24     bool* an = a + sizeof(a)/sizeof(a[0]);
     25 
     26     std::vector<bool> v(a, an);
     27     std::vector<bool>::reference r1 = v[0];
     28     std::vector<bool>::reference r2 = v[3];
     29 
     30 #if TEST_STD_VER >= 11
     31     static_assert((noexcept(v.swap(r1,r2))), "");
     32 #endif
     33 
     34     assert(!r1);
     35     assert( r2);
     36     v.swap(r1, r2);
     37     assert( r1);
     38     assert(!r2);
     39 }
     40