|
|
@ -15,8 +15,8 @@ CGRAPH_NAMESPACE_BEGIN |
|
|
|
|
|
|
|
template<typename FunctionType> |
|
|
|
auto UThreadPool::commit(const FunctionType& func, CIndex index) |
|
|
|
-> std::future<typename std::result_of<FunctionType()>::type> { |
|
|
|
using ResultType = typename std::result_of<FunctionType()>::type; |
|
|
|
-> std::future<decltype(std::declval<FunctionType>()())> { |
|
|
|
using ResultType = decltype(std::declval<FunctionType>()()); |
|
|
|
|
|
|
|
std::packaged_task<ResultType()> task(func); |
|
|
|
std::future<ResultType> result(task.get_future()); |
|
|
@ -43,8 +43,8 @@ auto UThreadPool::commit(const FunctionType& func, CIndex index) |
|
|
|
|
|
|
|
template<typename FunctionType> |
|
|
|
auto UThreadPool::commitWithPriority(const FunctionType& func, int priority) |
|
|
|
-> std::future<typename std::result_of<FunctionType()>::type> { |
|
|
|
using ResultType = typename std::result_of<FunctionType()>::type; |
|
|
|
-> std::future<decltype(std::declval<FunctionType>()())> { |
|
|
|
using ResultType = decltype(std::declval<FunctionType>()()); |
|
|
|
|
|
|
|
std::packaged_task<ResultType()> task(func); |
|
|
|
std::future<ResultType> result(task.get_future()); |
|
|
|