xref: /llvm-project/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_rv.pass.cpp (revision 57b08b0944046a6a57ee9b7b479181f548a5b9b4)
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 <size_t I, class... Types>
14 //   typename tuple_element<I, tuple<Types...> >::type&&
15 //   get(tuple<Types...>&& t);
16 
17 // UNSUPPORTED: c++98, c++03
18 
19 #include <tuple>
20 #include <utility>
21 #include <memory>
22 #include <cassert>
23 
24 int main()
25 {
26     {
27         typedef std::tuple<std::unique_ptr<int> > T;
28         T t(std::unique_ptr<int>(new int(3)));
29         std::unique_ptr<int> p = std::get<0>(std::move(t));
30         assert(*p == 3);
31     }
32 }
33