Re: getting member functions of a struct and Error: identifier expected following ., not this

2018-01-24 Thread aliak via Digitalmars-d-learn
On Wednesday, 24 January 2018 at 07:55:01 UTC, thedeemon wrote: On Tuesday, 23 January 2018 at 00:00:38 UTC, aliak wrote: [...] The struct defined inside a scope can mention variables defined in that scope (e.g. use them in its methods), so it needs a pointer to the place where those closed

Re: getting member functions of a struct and Error: identifier expected following ., not this

2018-01-23 Thread thedeemon via Digitalmars-d-learn
On Tuesday, 23 January 2018 at 00:00:38 UTC, aliak wrote: Hi, I'm trying to get a list of only member functions of a struct. I've found that if you do not declare a struct as static inside a scope, then there's a hidden "this" member as part of the struct. Can someone explain the logic there?

Re: getting member functions of a struct and Error: identifier expected following ., not this

2018-01-22 Thread aliak via Digitalmars-d-learn
On Tuesday, 23 January 2018 at 00:00:38 UTC, aliak wrote: Hi, I'm trying to get a list of only member functions of a [...] Cheers And a follow up question: should I be using static foreach in there instead of a normal foreach? i.e. foreach (member; __traits(allMembers, T)) {{ // same cod

getting member functions of a struct and Error: identifier expected following ., not this

2018-01-22 Thread aliak via Digitalmars-d-learn
Hi, I'm trying to get a list of only member functions of a struct. I've found that if you do not declare a struct as static inside a scope, then there's a hidden "this" member as part of the struct. Can someone explain the logic there? Also am I going about this correctly? template MemberFunc