diff options
author | aldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-08 03:20:30 +0000 |
---|---|---|
committer | aldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-08 03:20:30 +0000 |
commit | 643df0593c630691fa6877cddeefdd4c3023d444 (patch) | |
tree | 1eb48ad31d05a9ce117bedc17115de96dffa2f0b /libstdc++-v3/include/std/future | |
parent | 54f3f029d816c6d1626310649adfda740e203f7b (diff) | |
parent | d5d8f1ccc6d3972dc5cfc0949e85e0b1c9e24ee0 (diff) | |
download | gcc-transactional-memory.tar.gz |
* Merge from mainline rev 181122.transactional-memory
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/transactional-memory@181148 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/future')
-rw-r--r-- | libstdc++-v3/include/std/future | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 497b964833f..cc8779b40b3 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -955,6 +955,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_storage(__future_base::_S_allocate_result<_Res>(__a)) { } + template<typename _Allocator> + promise(allocator_arg_t, const _Allocator&, promise&& __rhs) + : _M_future(std::move(__rhs._M_future)), + _M_storage(std::move(__rhs._M_storage)) + { } + promise(const promise&) = delete; ~promise() @@ -1047,6 +1053,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_storage(__future_base::_S_allocate_result<_Res&>(__a)) { } + template<typename _Allocator> + promise(allocator_arg_t, const _Allocator&, promise&& __rhs) + : _M_future(std::move(__rhs._M_future)), + _M_storage(std::move(__rhs._M_storage)) + { } + promise(const promise&) = delete; ~promise() @@ -1122,6 +1134,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_storage(__future_base::_S_allocate_result<void>(__a)) { } + template<typename _Allocator> + promise(allocator_arg_t, const _Allocator&, promise&& __rhs) + : _M_future(std::move(__rhs._M_future)), + _M_storage(std::move(__rhs._M_storage)) + { } + promise(const promise&) = delete; ~promise() @@ -1270,6 +1288,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return std::forward<_Tp>(__t); } }; + template<typename _Task, typename _Fn, bool + = is_same<_Task, typename remove_reference<_Fn>::type>::value> + struct __is_same_pkgdtask + { typedef void __type; }; + + template<typename _Task, typename _Fn> + struct __is_same_pkgdtask<_Task, _Fn, true> + { }; + /// packaged_task template<typename _Res, typename... _ArgTypes> class packaged_task<_Res(_ArgTypes...)> @@ -1281,13 +1308,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Construction and destruction packaged_task() noexcept { } - template<typename _Fn> + template<typename _Allocator> + explicit + packaged_task(allocator_arg_t, const _Allocator& __a) noexcept + { } + + template<typename _Fn, typename = typename + __is_same_pkgdtask<packaged_task, _Fn>::__type> explicit packaged_task(_Fn&& __fn) : _M_state(std::make_shared<_State_type>(std::forward<_Fn>(__fn))) { } - template<typename _Fn, typename _Allocator> + template<typename _Fn, typename _Allocator, typename = typename + __is_same_pkgdtask<packaged_task, _Fn>::__type> explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fn&& __fn) : _M_state(std::allocate_shared<_State_type>(__a, @@ -1301,13 +1335,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // No copy - packaged_task(packaged_task&) = delete; - packaged_task& operator=(packaged_task&) = delete; + packaged_task(const packaged_task&) = delete; + packaged_task& operator=(const packaged_task&) = delete; + + template<typename _Allocator> + explicit + packaged_task(allocator_arg_t, const _Allocator&, + const packaged_task&) = delete; // Move support packaged_task(packaged_task&& __other) noexcept { this->swap(__other); } + template<typename _Allocator> + explicit + packaged_task(allocator_arg_t, const _Allocator&, + packaged_task&& __other) noexcept + { this->swap(__other); } + packaged_task& operator=(packaged_task&& __other) noexcept { packaged_task(std::move(__other)).swap(*this); |