Getting the parameters of a struct/class constructor

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Thu Jan 24 09:04:52 PST 2013


Hello all,

Is there a way to construct a tuple of the types that need to be passed to a 
struct or class's constructor?

I tried using ParameterTypeTuple either on the class or its constructor:

     ParameterTypeTuple!A

or

     ParameterTypeTuple!(A.this)

... but neither works: the former generates an error,

     Error: template instance ParameterTypeTuple!(A) ParameterTypeTuple!(A) does 
not match template declaration ParameterTypeTuple(func...) if (func.length == 1 
&& isCallable!(func))

while the latter generates,

     Error: identifier expected following '.', not 'this'

A (broken) bit of sample code is attached which illustrates what I'm trying to 
achieve.  Can anyone advise?

Thanks & best wishes,

      -- Joe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: constructparams.d
Type: text/x-dsrc
Size: 529 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130124/7f0e3250/attachment.d>


More information about the Digitalmars-d-learn mailing list