• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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);
13 
14 #include <vector>
15 #include <cassert>
16 #include "../../test_allocator.h"
17 
main()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);
30         assert(l2 == lo);
31         assert(l.empty());
32         assert(l2.get_allocator() == lo.get_allocator());
33     }
34     {
35         std::vector<bool, other_allocator<bool> > l(other_allocator<bool>(5));
36         std::vector<bool, other_allocator<bool> > lo(other_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, other_allocator<bool> > l2 = std::move(l);
43         assert(l2 == lo);
44         assert(l.empty());
45         assert(l2.get_allocator() == lo.get_allocator());
46     }
47 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
48 }
49