The code of std::function
in gcc has these two lines:
template<typename _Res, typename... _ArgTypes>
class function<_Res(_ArgTypes...)> // <-- unclear to me
The first part template... _ArgTypes
denotes a "parameter pack", i.e., a variadic number of template parameters; that is clear. But the second line is magic.
OK, writing class function<SmthHere>
means template specialization, so we specialize class function
with _Res(_ArgTypes...)
. The latter looks like a function call with a variable number of arguments. However if _Res
is void
and _ArgTypes
is int
, we get void(int)
: this doesn't make sense to me as we can't have a function named void
and pass an argument int
to it (??). Is this a specially supported syntax? Could you clarify?