foreach over pointers OR foreach that mutates the iterator
guest via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jan 26 02:19:29 PST 2017
On Wednesday, 25 January 2017 at 16:15:49 UTC, Las wrote:
> then I can do this:
> void main() {
> S s;
> auto p = &s;
> p.popFront;
> writeln(p.front);
> }
>
> But not this:
> void main() {
> S s;
> auto p = &s;
> foreach(i; p)
> writeln(i);
> }
>
p.popFront == p->popFront
This works as expected:
foreach(i; *p)
More information about the Digitalmars-d
mailing list