[Issue 2657] Remove opPostInc, opPostDec

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 13 08:37:36 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2657





------- Comment #1 from schveiguy at yahoo.com  2009-02-13 10:37 -------
I use it in dcollections iterators to do increment and decrement, sometimes I
use the return value (which is a copy of the iterator before incrementing).

However, I wouldn't mind getting rid of opPostInc *if* opInc was a true
operator, instead of the hackish += 1, which makes no sense for iterators.  I
have to put warning comments in the opAddAssign saying you should only call it
via ++i, because doing i += x can be an O(n) operation.

Yes, I know I could implement these as functions instead of operators, but the
syntax is so perfect for it, and it seamlessly fits with pointers.


-- 



More information about the Digitalmars-d-bugs mailing list