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 
     12 // vector(vector&& c, const allocator_type& a);
     13 
     14 #include <vector>
     15 #include <cassert>
     16 #include "../../test_allocator.h"
     17 
     18 int main()
     19 {
     20 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     21     {
     22         std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
     23         std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
     24         for (int i = 1; i <= 3; ++i)
     25         {
     26             l.push_back(i);
     27             lo.push_back(i);
     28         }
     29         std::vector<bool, test_allocator<bool> > l2(std::move(l), test_allocator<bool>(6));
     30         assert(l2 == lo);
     31         assert(!l.empty());
     32         assert(l2.get_allocator() == test_allocator<bool>(6));
     33     }
     34     {
     35         std::vector<bool, test_allocator<bool> > l(test_allocator<bool>(5));
     36         std::vector<bool, test_allocator<bool> > lo(test_allocator<bool>(5));
     37         for (int i = 1; i <= 3; ++i)
     38         {
     39             l.push_back(i);
     40             lo.push_back(i);
     41         }
     42         std::vector<bool, test_allocator<bool> > l2(std::move(l), test_allocator<bool>(5));
     43         assert(l2 == lo);
     44         assert(l.empty());
     45         assert(l2.get_allocator() == test_allocator<bool>(5));
     46     }
     47     {
     48         std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5));
     49         std::vector<bool, other_allocator<bool> > lo(other_allocator<bool>(5));
     50         for (int i = 1; i <= 3; ++i)
     51         {
     52             l.push_back(i);
     53             lo.push_back(i);
     54         }
     55         std::vector<bool, other_allocator<bool> > l2(std::move(l), other_allocator<bool>(4));
     56         assert(l2 == lo);
     57         assert(!l.empty());
     58         assert(l2.get_allocator() == other_allocator<bool>(4));
     59     }
     60 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     61 }
     62