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=(const tuple& u);
     15 
     16 // UNSUPPORTED: c++98, c++03
     17 
     18 #include <tuple>
     19 #include <string>
     20 #include <cassert>
     21 
     22 int main()
     23 {
     24     {
     25         typedef std::tuple<> T;
     26         T t0;
     27         T t;
     28         t = t0;
     29     }
     30     {
     31         typedef std::tuple<int> T;
     32         T t0(2);
     33         T t;
     34         t = t0;
     35         assert(std::get<0>(t) == 2);
     36     }
     37     {
     38         typedef std::tuple<int, char> T;
     39         T t0(2, 'a');
     40         T t;
     41         t = t0;
     42         assert(std::get<0>(t) == 2);
     43         assert(std::get<1>(t) == 'a');
     44     }
     45     {
     46         typedef std::tuple<int, char, std::string> T;
     47         const T t0(2, 'a', "some text");
     48         T t;
     49         t = t0;
     50         assert(std::get<0>(t) == 2);
     51         assert(std::get<1>(t) == 'a');
     52         assert(std::get<2>(t) == "some text");
     53     }
     54 }
     55