minix/external/bsd/libc++/dist/libcxx/test/utilities/utility/pairs/pair.astuple/get_rv.pass.cpp
Lionel Sambuc 4684ddb6aa LLVM Minix changes
- import libcxx
 - reduce targets to the one when compiled as a tools

Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
2014-07-28 17:05:59 +02:00

32 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
}