What does `struct decay <T, R (A ..., ...)>` mean?
2 answers
int foo(int);
int bar(int, ...);
these are two different functions. foo
has type int(int)
. bar
has type int(int,...)
.
...
is C-style varargs so as not to be confused with the arguments of the variational pattern that they also use ...
.
template <typename T, typename R, typename ...A>
struct decay<T, R(A..., ...)> { using type = R(*)(A..., ...); };
This part of the implementation of the optimized version is std::decay
inside boost::hana
. Parts typename T
and T
are red herrings, part of this optimization.
This specialization, which corresponds to R(A..., ...)
, where A...
and R
are derived from the signature of the function.
double(int, char, ...)
hana::details::decay
, R
double
, A...
int, char
. ...
" C".
, , varargs C-, . double(int, char, ...)
double(*)(int, char, ...)
.
C . .
+7