opStar

Bruce Adams tortoise_74 at yeah.woo.co.uk
Sat Nov 10 06:15:25 PST 2007


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.
> 
> What's opStar for, if not to implement iterators?

Think about what your asking for for a minute though.
If  p.member was an alias for (*p).member  how would you be able to access any p.member in order to implement *p in the first place. The idea doesn't make sense. "Please god no!" was something of an understatement if you ask me.
I think this is one reason why C++ has . & -> and you can never overload .
Smart pointers will have to be done a different (and hopefully better)
way in D.




More information about the Digitalmars-d mailing list