Extracting function param types using variadic templates
Jarrett Billingsley
kb3ctd2 at yahoo.com
Fri Nov 3 20:58:23 PST 2006
"Tom S" <h3r3tic at remove.mat.uni.torun.pl> wrote in message
news:eigch3$ilf$1 at digitaldaemon.com...
> Jarrett Billingsley wrote:
>> Is there maybe some other way to get at the parameter types of a function
>> as a tuple, using variadic magic?
>
> How about this stuff:
> http://www.dsource.org/projects/pyd/browser/trunk/infrastructure/meta ?
But that's basically using my third example, i.e.
void returnAndArg(T, U)(T delegate(U) dg){}
returnAndArg(delegate int(bool b){ return 0; });
But with many specializations of the template, one for each number of
params. The point of using variadic templates is removing the need to
manually create a specialization for each number of things you want in the
typelist. With the automatic tuple deduction that I wish existed, the
FuncMeta.d module would become about 80 lines of code, and it would be able
to support any number of arguments.
More information about the Digitalmars-d
mailing list