On Friday, 13 September 2013 at 14:02:15 UTC, Gary Willoughby
wrote:
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.
I know what you mean. Have been using quite some __traits and
is(), and I still have to look up the syntax for is() all the
time, and experiment with both trying to find the edge-cases.
My biggest problem is that there's only one possible context
pointer for templates and that often DMD is unable to use
contexts even though they are mixed in at the call-site and
really should be available...