Skip to content

Commit

Permalink
replace std::result_of with std::invoke_result
Browse files Browse the repository at this point in the history
  • Loading branch information
thelfer committed Sep 5, 2024
1 parent 2fffaff commit 5cb6e39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/MGIS/ThreadPool.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace mgis {
* \param[in] a: arguments passed to the the task
*/
template <typename F, typename... Args>
std::future<ThreadedTaskResult<typename std::result_of<F(Args...)>::type>>
std::future<ThreadedTaskResult<typename std::invoke_result<F(Args...)>::type>>
addTask(F&&, Args&&...);
//! \return the number of threads managed by the ppol
size_type getNumberOfThreads() const;
Expand Down
8 changes: 4 additions & 4 deletions include/MGIS/ThreadPool.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ namespace mgis {
struct ThreadPool::Wrapper {
Wrapper(F&& f_) : f(f_) {}
template <typename... Args>
ThreadedTaskResult<typename std::result_of<F(Args...)>::type> operator()(
ThreadedTaskResult<typename std::invoke_result<F(Args...)>::type> operator()(
Args&&... args) {
using result = typename std::result_of<F(Args...)>::type;
using result = typename std::invoke_result<F(Args...)>::type;
using apply = typename std::conditional<std::is_same<result, void>::value,
GetVoid, Get<result>>::type;
ThreadedTaskResult<result> r;
Expand Down Expand Up @@ -61,10 +61,10 @@ namespace mgis {

// add new work item to the pool
template <typename F, typename... Args>
std::future<ThreadedTaskResult<typename std::result_of<F(Args...)>::type>>
std::future<ThreadedTaskResult<typename std::invoke_result<F(Args...)>::type>>
ThreadPool::addTask(F&& f, Args&&... a) {
using return_type =
ThreadedTaskResult<typename std::result_of<F(Args...)>::type>;
ThreadedTaskResult<typename std::invoke_result<F(Args...)>::type>;
using task = std::packaged_task<return_type()>;
auto t = std::make_shared<task>(
std::bind(Wrapper<F>(std::forward<F>(f)), std::forward<Args>(a)...));
Expand Down

0 comments on commit 5cb6e39

Please sign in to comment.