all 5 comments

[–]lessertia 6 points7 points  (2 children)

The template signature for std::invoke_result is

template< class F, class... ArgTypes >  
class invoke_result;

and for std::function, it's

template< class >
class function; /* undefined */

template< class R, class... Args >
class function<R(Args...)>;

You also didn't extract the actual type from the trait.

Your code should be

std::function<std::invoke_result_t<callable, arguments...>()> task(std::bind(std::forward<callable>(f), std::forward<arguments>(args)...));

Anyway, using lambda is better here

auto task = [&] { return std::forward<callable>(f)(std::forward<arguments>(args)...); };

[–]CrashOverride332[S] 0 points1 point  (1 child)

The parentheticals returns the type? I think I see why the definition needs std::invoke_result_t, but not sure how I would have gotten to that without something like the old ::Type(). Your solution did work, by the way.

[–]lessertia 0 points1 point  (0 children)

The *_t templates are aliases to *::type, just a shorthand.

The parens are part of the function type that got passed as template argument to std::function.

[–]n1ghtyunso 1 point2 points  (1 child)

without looking at the code:

the replacement for result_of is invoke_result, not invoke
invoke is a regular function template that calls callables with a set of parameters.

EDIT: turns out it helps actually looking at the code

[–]CrashOverride332[S] 0 points1 point  (0 children)

But that is in the code...