opStar
Walter Bright
newshound1 at digitalmars.com
Mon Nov 12 09:05:27 PST 2007
Janice Caron wrote:
> On Nov 12, 2007 8:50 AM, Walter Bright <newshound1 at digitalmars.com> wrote:
>> 1) copy
>> 2) increment
>> 3) compare for equality
>> 4) get the value
>
> You missed
> 5) assignment
I think (1) covers that.
> (And also decrement, but I guess increment and decrement are both just
> special cases of adding or subtracting an integer)
Yes. Also, some iterators (like a linked list iterator) cannot go
backwards. But all must be able to go forwards.
> You also haven't addressed the point that since no function, opStar
> included, can return a reference to a struct, then we are forced to
> return a pointer to a struct, so now your iterator behaves not like a
> pointer, but a pointer to a pointer.
Iterators should be very small value types. I don't see why one would be
returning a reference to an iterator.
More information about the Digitalmars-d
mailing list