blob: b454aec2e6cfcc027d8c9486b341979766d19d37 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. 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
18int main()
19{
Howard Hinnant73d21a42010-09-04 23:28:19 +000020#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000021 {
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 }
Howard Hinnant73d21a42010-09-04 23:28:19 +000047#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000048}