Extracting function param types using variadic templates
Kirk McDonald
kirklin.mcdonald at gmail.com
Fri Nov 3 21:49:42 PST 2006
Jarrett Billingsley wrote:
> "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.
>
>
This was approximately the first thing I tried doing with variadic
templates. I was very saddened to see that it doesn't work.
--
Kirk McDonald
Pyd: Wrapping Python with D
http://pyd.dsource.org
More information about the Digitalmars-d
mailing list