However, when I use the class with foreach, the opindex gets called to create a dynamic array, rather than use the empty(),front(),popFront() routines. I would prefer it use the three methods, rather than create a dynamic array.
I made a stack data type and created an opIndex() so it could be
turned into a dynamic array, and created empty() (unfortunate
name), front() and popFront() methods, which I read allow it to
be used with foreach.
- User defined type and foreach Tony via Digitalmars-d-learn
- Re: User defined type an... Andrea Fontana via Digitalmars-d-learn
- Re: User defined typ... Tony via Digitalmars-d-learn
- Re: User defined... Jonathan M Davis via Digitalmars-d-learn
- Re: User defined type an... Steven Schveighoffer via Digitalmars-d-learn
- Re: User defined typ... Tony via Digitalmars-d-learn
- Re: User defined type an... ag0aep6g via Digitalmars-d-learn
- Re: User defined typ... Tony via Digitalmars-d-learn
- Re: User defined... Tony via Digitalmars-d-learn
- Re: User defined typ... Steven Schveighoffer via Digitalmars-d-learn
- Re: User defined... Tony via Digitalmars-d-learn