2010-08-29 16:20:30 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2010-11-16 23:09:02 +01:00
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
2010-08-29 16:20:30 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
// <future>
|
|
|
|
|
|
|
|
// class future<R>
|
|
|
|
|
|
|
|
// future(future&& rhs);
|
|
|
|
|
|
|
|
#include <future>
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2010-09-05 01:28:19 +02:00
|
|
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-08-29 16:20:30 +02:00
|
|
|
{
|
|
|
|
typedef int T;
|
|
|
|
std::promise<T> p;
|
|
|
|
std::future<T> f0 = p.get_future();
|
|
|
|
std::future<T> f = std::move(f0);
|
|
|
|
assert(!f0.valid());
|
|
|
|
assert(f.valid());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
typedef int T;
|
|
|
|
std::future<T> f0;
|
|
|
|
std::future<T> f = std::move(f0);
|
|
|
|
assert(!f0.valid());
|
|
|
|
assert(!f.valid());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
typedef int& T;
|
|
|
|
std::promise<T> p;
|
|
|
|
std::future<T> f0 = p.get_future();
|
|
|
|
std::future<T> f = std::move(f0);
|
|
|
|
assert(!f0.valid());
|
|
|
|
assert(f.valid());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
typedef int& T;
|
|
|
|
std::future<T> f0;
|
|
|
|
std::future<T> f = std::move(f0);
|
|
|
|
assert(!f0.valid());
|
|
|
|
assert(!f.valid());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
typedef void T;
|
|
|
|
std::promise<T> p;
|
|
|
|
std::future<T> f0 = p.get_future();
|
|
|
|
std::future<T> f = std::move(f0);
|
|
|
|
assert(!f0.valid());
|
|
|
|
assert(f.valid());
|
|
|
|
}
|
|
|
|
{
|
|
|
|
typedef void T;
|
|
|
|
std::future<T> f0;
|
|
|
|
std::future<T> f = std::move(f0);
|
|
|
|
assert(!f0.valid());
|
|
|
|
assert(!f.valid());
|
|
|
|
}
|
2010-09-05 01:28:19 +02:00
|
|
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
2010-08-29 16:20:30 +02:00
|
|
|
}
|