Get constructor for a class
Gary Willoughby
dev at nomad.so
Fri Sep 13 07:02:14 PDT 2013
On Friday, 13 September 2013 at 13:31:34 UTC, simendsjo wrote:
> On Friday, 13 September 2013 at 13:16:12 UTC, Gary Willoughby
> wrote:
>> On Friday, 13 September 2013 at 09:12:53 UTC, simendsjo wrote:
>>> allMembers returns "this", but trying to get "this" or
>>> "__ctor" using getMember fails. Is there any way to get this
>>> method?
>>
>> foreach (func; __traits(getOverloads, T, "__ctor"))
>> {
>> ...
>> }
>
> Thanks.
>
> Still a bit strange though.. "this" is always a member for
> classes, but if there's only an implicit ctor, only "this"
> exists, and getOverloads "__ctor" fails.
>
> If there exists explicit ctors on the other hand, both "this"
> *and* "__ctor" exists.
A lot of the traits stuff is very confusing, i think a lot of it
is still being finalised and in development. I'm working on a
project using a lot of traits stuff and it's doing my head in. I
wish there was better documentation. e.g. what is 'func' in the
code above? i'm using it successfully but i've no idea what it is.
More information about the Digitalmars-d-learn
mailing list