//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // deque(deque&& c, const allocator_type& a); #include #include #include "../../../MoveOnly.h" #include "../../../test_allocator.h" int main() { #ifdef _LIBCPP_MOVE { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); typedef test_allocator A; std::deque c1(A(1)); for (int* p = ab; p < an; ++p) c1.push_back(MoveOnly(*p)); std::deque c2(A(1)); for (int* p = ab; p < an; ++p) c2.push_back(MoveOnly(*p)); std::deque c3(std::move(c1), A(3)); assert(c2 == c3); assert(c3.get_allocator() == A(3)); assert(c1.size() != 0); } { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); typedef test_allocator A; std::deque c1(A(1)); for (int* p = ab; p < an; ++p) c1.push_back(MoveOnly(*p)); std::deque c2(A(1)); for (int* p = ab; p < an; ++p) c2.push_back(MoveOnly(*p)); std::deque c3(std::move(c1), A(1)); assert(c2 == c3); assert(c3.get_allocator() == A(1)); assert(c1.size() == 0); } { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); typedef other_allocator A; std::deque c1(A(1)); for (int* p = ab; p < an; ++p) c1.push_back(MoveOnly(*p)); std::deque c2(A(1)); for (int* p = ab; p < an; ++p) c2.push_back(MoveOnly(*p)); std::deque c3(std::move(c1), A(3)); assert(c2 == c3); assert(c3.get_allocator() == A(3)); assert(c1.size() != 0); } #endif // _LIBCPP_MOVE }