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