opStar

Bill Baxter dnewsgroup at billbaxter.com
Sat Nov 10 23:10:26 PST 2007


Walter Bright wrote:
> Janice Caron wrote:
>> So, we can write p.m for real pointers, but we have to write (*p).m
>> for classes that implement opStar()? That seems inconsistent.
> 
> Not really. You cannot overload references in C++, either.
> 
>> What's opStar for, if not to implement iterators?
> 
> For iterators. Should a class be used as an iterator? I can't see how 
> that would make sense anyway.

If you're not going to be able to access members and such via the 
opStar, why not just have iterators use a convention like p.val to 
access the value pointed too, rather than *p.  Why does it need to be an 
operator?

--bb



More information about the Digitalmars-d mailing list