Browse Source

Merge pull request #4 from hopenobug/support_cpp20

feat: 支持C++20编译
Chunel 2 years ago
committed by GitHub
parent
commit
fff91e1dd6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions
  1. +2
    -2
      src/UtilsCtrl/ThreadPool/UThreadPool.h
  2. +4
    -4
      src/UtilsCtrl/ThreadPool/UThreadPool.inl

+ 2
- 2
src/UtilsCtrl/ThreadPool/UThreadPool.h View File

@ -65,7 +65,7 @@ public:
template<typename FunctionType> template<typename FunctionType>
auto commit(const FunctionType& func, auto commit(const FunctionType& func,
CIndex index = CGRAPH_DEFAULT_TASK_STRATEGY) CIndex index = CGRAPH_DEFAULT_TASK_STRATEGY)
-> std::future<typename std::result_of<FunctionType()>::type>;
-> std::future<decltype(std::declval<FunctionType>()())>;
/** /**
* *
@ -78,7 +78,7 @@ public:
template<typename FunctionType> template<typename FunctionType>
auto commitWithPriority(const FunctionType& func, auto commitWithPriority(const FunctionType& func,
int priority) int priority)
-> std::future<typename std::result_of<FunctionType()>::type>;
-> std::future<decltype(std::declval<FunctionType>()())>;
/** /**
* *

+ 4
- 4
src/UtilsCtrl/ThreadPool/UThreadPool.inl View File

@ -15,8 +15,8 @@ CGRAPH_NAMESPACE_BEGIN
template<typename FunctionType> template<typename FunctionType>
auto UThreadPool::commit(const FunctionType& func, CIndex index) 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::packaged_task<ResultType()> task(func);
std::future<ResultType> result(task.get_future()); std::future<ResultType> result(task.get_future());
@ -43,8 +43,8 @@ auto UThreadPool::commit(const FunctionType& func, CIndex index)
template<typename FunctionType> template<typename FunctionType>
auto UThreadPool::commitWithPriority(const FunctionType& func, int priority) 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::packaged_task<ResultType()> task(func);
std::future<ResultType> result(task.get_future()); std::future<ResultType> result(task.get_future());

Loading…
Cancel
Save