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

aliak something at something.com
Wed Jan 24 17:38:02 UTC 2018


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 variables live. That's 
> the main difference between such struct and a static one that 
> cannot use those scope vars. I guess you're seeing that pointer 
> as additional member.
>
>
> As for static foreach, when you write a simple foreach over 
> some compile-time tuple (like in this case), it's unrolled at 
> compile time similarly to "static foreach", the main difference 
> is whether it creates a sub-scope for the loop body or not. 
> "foreach" creates one, "static foreach" doesn't.

Ah makes sense. Thanks!


More information about the Digitalmars-d-learn mailing list