]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp
Import libc++ 3.7.0 release (r246257).
[FreeBSD/FreeBSD.git] / test / std / utilities / utility / pairs / pair.astuple / get_rv.pass.cpp
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 // <utility>
11
12 // template <class T1, class T2> struct pair
13
14 // template<size_t I, class T1, class T2>
15 //     typename tuple_element<I, std::pair<T1, T2> >::type&&
16 //     get(pair<T1, T2>&&);
17
18 #include <utility>
19 #include <memory>
20 #include <cassert>
21
22 int main()
23 {
24 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
25     {
26         typedef std::pair<std::unique_ptr<int>, short> P;
27         P p(std::unique_ptr<int>(new int(3)), 4);
28         std::unique_ptr<int> ptr = std::get<0>(std::move(p));
29         assert(*ptr == 3);
30     }
31 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
32 }