cxx/test/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp
Howard Hinnant cd2254b454 LWG 1191
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 19:52:17 +00:00

33 lines
915 B
C++

//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <utility>
// template <class T1, class T2> struct pair
// template<size_t I, class T1, class T2>
// typename tuple_element<I, std::pair<T1, T2> >::type&&
// get(pair<T1, T2>&&);
#include <utility>
#include <memory>
#include <cassert>
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
typedef std::pair<std::unique_ptr<int>, short> P;
P p(std::unique_ptr<int>(new int(3)), 4);
std::unique_ptr<int> ptr = std::get<0>(std::move(p));
assert(*ptr == 3);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}