std::invoke takes something called and arguments to call it, and makes the call. std::invoke( f, args... ) is a small generalization of the input f(args...) , which also handles several additional cases.
Something called includes a pointer to a function or reference, a pointer to a member function, an object with operator() or a pointer to the data of an element.
In member cases, the first argument is interpreted as this . Then the remaining arguments are passed to () (except in the case of a pointer-member-data-member).
INVOKE was a concept in the C ++ standard; C ++ 17 just exposes std::invoke , which does this directly. I suspect it was open because it was useful in other metaprogramming, partly because each standard library already has an INVOKE implementation, and exposing it was mostly free, and partly because it made it easier to talk about INVOKE when this is a specific thing.
Yakk
source share