1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++98, c++03 10 11 // <stack> 12 13 // stack& operator=(stack&& q); 14 15 #include <stack> 16 #include <cassert> 17 18 #include "MoveOnly.h" 19 20 21 template <class C> 22 C 23 make(int n) 24 { 25 C c; 26 for (int i = 0; i < n; ++i) 27 c.push_back(MoveOnly(i)); 28 return c; 29 } 30 31 32 int main(int, char**) 33 { 34 std::stack<MoveOnly> q(make<std::deque<MoveOnly> >(5)); 35 std::stack<MoveOnly> q2; 36 q2 = std::move(q); 37 assert(q2.size() == 5); 38 assert(q.empty()); 39 40 return 0; 41 } 42