diff options
author | Howard Hinnant <hhinnant@apple.com> | 2010-09-03 18:39:25 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2010-09-03 18:39:25 +0000 |
commit | ead85506a763516f78f3671cde20c22fb7143312 (patch) | |
tree | d1025205884fef58ba745b9c2b0032bdaf80ff76 /libcxx/test/thread/futures/futures.shared_future/move_ctor.pass.cpp | |
parent | 03f4be86ba780e890a974da7cd5511491c3e6eac (diff) | |
download | bcm5719-llvm-ead85506a763516f78f3671cde20c22fb7143312.tar.gz bcm5719-llvm-ead85506a763516f78f3671cde20c22fb7143312.zip |
[futures.shared_future]
llvm-svn: 112990
Diffstat (limited to 'libcxx/test/thread/futures/futures.shared_future/move_ctor.pass.cpp')
-rw-r--r-- | libcxx/test/thread/futures/futures.shared_future/move_ctor.pass.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/libcxx/test/thread/futures/futures.shared_future/move_ctor.pass.cpp b/libcxx/test/thread/futures/futures.shared_future/move_ctor.pass.cpp new file mode 100644 index 00000000000..2130071c75c --- /dev/null +++ b/libcxx/test/thread/futures/futures.shared_future/move_ctor.pass.cpp @@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <future> + +// class shared_future<R> + +// shared_future(shared_future&& rhs); + +#include <future> +#include <cassert> + +int main() +{ + { + typedef int T; + std::promise<T> p; + std::shared_future<T> f0 = p.get_future(); + std::shared_future<T> f = std::move(f0); + assert(!f0.valid()); + assert(f.valid()); + } + { + typedef int T; + std::shared_future<T> f0; + std::shared_future<T> f = std::move(f0); + assert(!f0.valid()); + assert(!f.valid()); + } + { + typedef int& T; + std::promise<T> p; + std::shared_future<T> f0 = p.get_future(); + std::shared_future<T> f = std::move(f0); + assert(!f0.valid()); + assert(f.valid()); + } + { + typedef int& T; + std::shared_future<T> f0; + std::shared_future<T> f = std::move(f0); + assert(!f0.valid()); + assert(!f.valid()); + } + { + typedef void T; + std::promise<T> p; + std::shared_future<T> f0 = p.get_future(); + std::shared_future<T> f = std::move(f0); + assert(!f0.valid()); + assert(f.valid()); + } + { + typedef void T; + std::shared_future<T> f0; + std::shared_future<T> f = std::move(f0); + assert(!f0.valid()); + assert(!f.valid()); + } +} |