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 // template <class U1, class U2> 15 // tuple& operator=(pair<U1, U2>&& u); 16 17 // UNSUPPORTED: c++98, c++03 18 19 #include <tuple> 20 #include <utility> 21 #include <memory> 22 #include <cassert> 23 24 struct B 25 { 26 int id_; 27 28 explicit B(int i = 0) : id_(i) {} 29 30 virtual ~B() {} 31 }; 32 33 struct D 34 : B 35 { 36 explicit D(int i) : B(i) {} 37 }; 38 39 int main() 40 { 41 { 42 typedef std::pair<double, std::unique_ptr<D>> T0; 43 typedef std::tuple<int, std::unique_ptr<B>> T1; 44 T0 t0(2.5, std::unique_ptr<D>(new D(3))); 45 T1 t1; 46 t1 = std::move(t0); 47 assert(std::get<0>(t1) == 2); 48 assert(std::get<1>(t1)->id_ == 3); 49 } 50 } 51