File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,14 +40,13 @@ export namespace CppUtils::Thread
4040 worker.stop();
4141 }
4242
43- template<class Func, class... Args>
44- inline auto call(Func&& function, Args&&... args) -> std::future<std::invoke_result_t<Func, Args...>>
43+ inline auto call(auto&& function) -> std::future<std::invoke_result_t<std::decay_t<decltype(function)>>>
4544 {
46- using ReturnType = std::invoke_result_t<Func, Args... >;
47- auto task = std::make_shared<std::packaged_task<ReturnType()>>([this, function = std::forward<Func> (function), ... args = std::forward<Args>(args )]() {
45+ using ReturnType = std::invoke_result_t<std::decay_t<decltype(function)> >;
46+ auto task = std::make_shared<std::packaged_task<ReturnType()>>([this, function = std::forward<decltype (function)>(function )]() {
4847 try
4948 {
50- std::invoke(function, std::move(args)... );
49+ std::invoke(function);
5150 }
5251 catch (...)
5352 {
You can’t perform that action at this time.
0 commit comments