mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-07 10:34:54 -06:00
Async rewritten in C++11
git-svn-id: svn://ultimatepp.org/upp/trunk@11446 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
dec31627bc
commit
2f86599e51
1 changed files with 12 additions and 6 deletions
|
|
@ -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::result_of_t<std::decay_t<Function>(std::decay_t<Args>...)>>
|
||||
AsyncWork<
|
||||
typename std::result_of<
|
||||
typename std::decay<Function>::type
|
||||
(typename std::decay<Args>::type...)
|
||||
>::type
|
||||
>
|
||||
Async(Function&& f, Args&&... args)
|
||||
{
|
||||
AsyncWork<std::result_of_t<std::decay_t<Function>(std::decay_t<Args>...)>> h;
|
||||
AsyncWork<
|
||||
typename std::result_of<
|
||||
typename std::decay<Function>::type
|
||||
(typename std::decay<Args>::type...)
|
||||
>::type
|
||||
> h;
|
||||
h.Do(f, args...);
|
||||
return pick(h);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
class CoWork : NoCopy {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue