xref: /llvm-project/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.elem/get_rv.pass.cpp (revision 31cbe0f240f660f15602c96b787c58a26f17e179)
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++03
18 
19 #include <tuple>
20 #include <utility>
21 #include <memory>
22 #include <cassert>
23 
24 #include "test_macros.h"
25 
main(int,char **)26 int main(int, char**)
27 {
28     {
29         typedef std::tuple<std::unique_ptr<int> > T;
30         T t(std::unique_ptr<int>(new int(3)));
31         std::unique_ptr<int> p = std::get<0>(std::move(t));
32         assert(*p == 3);
33     }
34 
35   return 0;
36 }
37