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 // <tuple> 10 11 // template <class... Types> class tuple; 12 13 // template <class U1, class U2> tuple(pair<U1, U2>&& u); 14 15 // UNSUPPORTED: c++03 16 17 #include <tuple> 18 #include <utility> 19 #include <memory> 20 #include <cassert> 21 22 #include "test_macros.h" 23 24 struct B 25 { 26 int id_; 27 28 explicit B(int i) : 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(int, char**) 40 { 41 { 42 typedef std::pair<long, std::unique_ptr<D>> T0; 43 typedef std::tuple<long long, std::unique_ptr<B>> T1; 44 T0 t0(2, std::unique_ptr<D>(new D(3))); 45 T1 t1 = std::move(t0); 46 assert(std::get<0>(t1) == 2); 47 assert(std::get<1>(t1)->id_ == 3); 48 } 49 50 return 0; 51 } 52