From 2f86599e51574df4d8a015b72be2c4ed5fbfdc03 Mon Sep 17 00:00:00 2001 From: cxl Date: Sat, 11 Nov 2017 14:32:04 +0000 Subject: [PATCH] Async rewritten in C++11 git-svn-id: svn://ultimatepp.org/upp/trunk@11446 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/CoWork.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/uppsrc/Core/CoWork.h b/uppsrc/Core/CoWork.h index c1840d9f6..79094e56c 100644 --- a/uppsrc/Core/CoWork.h +++ b/uppsrc/Core/CoWork.h @@ -155,19 +155,25 @@ public: ~AsyncWork() { if(imp) imp->co.Cancel(); } }; -#if !defined(__clang__) || 1000 * __clang_major__ + __clang_minor__ > 3004 - template< class Function, class... Args> -AsyncWork(std::decay_t...)>> +AsyncWork< + typename std::result_of< + typename std::decay::type + (typename std::decay::type...) + >::type +> Async(Function&& f, Args&&... args) { - AsyncWork(std::decay_t...)>> h; + AsyncWork< + typename std::result_of< + typename std::decay::type + (typename std::decay::type...) + >::type + > h; h.Do(f, args...); return pick(h); } -#endif - #else class CoWork : NoCopy {