Skip to content

Commit

Permalink
STYLE: Replace std::bind in ThreadPool::AddWork with lambda expression
Browse files Browse the repository at this point in the history
Inspired by pull request SimpleITK/SimpleITK#1994
commit SimpleITK/SimpleITK@0dc078f
"Use clang-tidy with modernize-avoid-bind", by Bradley Lowekamp.
  • Loading branch information
N-Dekker committed Sep 29, 2023
1 parent 82d7060 commit 9f979d1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Modules/Core/Common/include/itkThreadPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ auto result = pool->AddWork([](int param) { return param; }, 7);
using return_type = std::invoke_result_t<Function, Arguments...>;

auto task = std::make_shared<std::packaged_task<return_type()>>(
std::bind(std::forward<Function>(function), std::forward<Arguments>(arguments)...));
[function, arguments...]() -> return_type { return function(arguments...); });

std::future<return_type> res = task->get_future();
{
Expand Down

0 comments on commit 9f979d1

Please sign in to comment.