Less... but it comes with its own caveat, in order to use it, you must have one parameter of generic-type T, before ...Args (if you want to do anything useful with the type info).
Another let-down is that you can't pass void to T (if you have a parameter that is of type T), which means you must have some extra bit of data OR have an overload for your function that only takes the parameters before T.
For my case of string formatting, this is redundant because I'd literally just be returning the same string passed in.
But over-all, yes. Variadic templates are something I adore. And I wish Java had them (then maybe I would have stuck around for a little longer).
Less... but it comes with its own caveat, in order to use it, you must have one parameter of generic-type
T
, before...Args
(if you want to do anything useful with the type info).Another let-down is that you can't pass
void
toT
(if you have a parameter that is of typeT
), which means you must have some extra bit of data OR have an overload for your function that only takes the parameters beforeT
.For my case of string formatting, this is redundant because I'd literally just be returning the same string passed in.
But over-all, yes. Variadic templates are something I adore.
And I wish Java had them (then maybe I would have stuck around for a little longer).Doesn't Vargs also need to have at least one argument before the parameter pack too?
Could you expand on your second point?