Home | History | Annotate | Download | only in tuple.assign
      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 // <tuple>
     11 
     12 // template <class... Types> class tuple;
     13 
     14 // tuple& operator=(tuple&& u);
     15 
     16 // UNSUPPORTED: c++98, c++03
     17 
     18 #include <tuple>
     19 #include <utility>
     20 #include <cassert>
     21 
     22 #include "MoveOnly.h"
     23 
     24 int main()
     25 {
     26     {
     27         typedef std::tuple<> T;
     28         T t0;
     29         T t;
     30         t = std::move(t0);
     31     }
     32     {
     33         typedef std::tuple<MoveOnly> T;
     34         T t0(MoveOnly(0));
     35         T t;
     36         t = std::move(t0);
     37         assert(std::get<0>(t) == 0);
     38     }
     39     {
     40         typedef std::tuple<MoveOnly, MoveOnly> T;
     41         T t0(MoveOnly(0), MoveOnly(1));
     42         T t;
     43         t = std::move(t0);
     44         assert(std::get<0>(t) == 0);
     45         assert(std::get<1>(t) == 1);
     46     }
     47     {
     48         typedef std::tuple<MoveOnly, MoveOnly, MoveOnly> T;
     49         T t0(MoveOnly(0), MoveOnly(1), MoveOnly(2));
     50         T t;
     51         t = std::move(t0);
     52         assert(std::get<0>(t) == 0);
     53         assert(std::get<1>(t) == 1);
     54         assert(std::get<2>(t) == 2);
     55     }
     56 }
     57