__traits and std.traits and constructors

Philippe Sigaud philippe.sigaud at gmail.com
Sun Nov 14 07:13:43 PST 2010


On Sun, Nov 14, 2010 at 11:16, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> Is there a way to get use constructors with traits functions that take a
> function? For instance, functionAttributes!(func) takes a func and tells you
> whether it's pure, nothrow, etc. However, giving it the type doesn't work (i.e.
> functionAttributes!T), and giving it this doesn't work (i.e. functionAttributes!
> (T.this)), and functionAttributes!(T()) doesn't work either (though that's
> probably trying to use opCall()). Is there a way to pass the constructor to
> traits functinos like functionAttributes!(). And if so, how?

does T.__ctor work?

I mean, when you ask for the members with __traits(AllMembers, T),
constructors are given as __ctor and have type: T delegate(args).
So maybe the constructors are indeed internally called "__ctor".

Philippe


More information about the Digitalmars-d-learn mailing list