opStar
Janice Caron
caron800 at googlemail.com
Sun Nov 11 23:31:36 PST 2007
On Nov 12, 2007 12:40 AM, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
> Also I noticed that if smart member access is going to be the default
> then it seems necessary to make clear it doesn't apply to operators.
> That is, ++p may be equivalent to p.opPreIncr generally, but that
> doesn't mean that ++p will call p.opDeref.opPreIncr. For that you'll
> still need the explicit dereference: ++(*p).
>
> Without that rule iterators will look pretty ugly.
You're right. Operators need to be an exception to the general rule.
Well spotted.
It's not really a exception though, because it would be /conforming/
to a higher principle - to the principle that: "iterators should
behave like pointers". It's a principle which will lead to code that
is not confusing.
More information about the Digitalmars-d
mailing list