
Originally Posted by
aurik
Furthermore, consider you have an iterator over the fibbonacci numbers: 0,1,1,2,3,5,8... In this case your idea of "++" is totally deceptive, as it is of all iterators over a set of numbers that aren't necessarily in counting order. (0)++ gives you (1), then (1)++ gives you (1), then (1)++ again gives you (2)... later on, (8)++ gives you (13). What the fuck? At least with next() you understand that your iteration operation isn't necessarily "add one to the value".
I wouldn't expect (8)++ to return (9) anyway, because
I should understand that what I have is not an integer, but an index into a sequence of integers. If I had a class called FibonacciNumber, and on that class I overloaded the ++ operator to return the next Fibonacci number, that would definitely be an abuse of operator overloading (in fact, it would be an abuse of a 'class', but that's an entirely separate debate, lol). But I wouldn't advocate that, I'd advocate overloading the ++ operator a separate object, perhaps I'd call it FibonacciSequenceIterator. Calling ++ on that object, I'd definitely expect (8)++ to return (13).
When you have a sequence, you typically refer to the sequence with an index, like s[n] perhaps. n is your iterator, and adding 1 to it moves to the next item in the sequence. (8) isn't the number 8, it's s[5]. and (13) isn't the number 13, it's s[6]. Iterator++ simply increments the sequence index by 1. It changes the value 5 to the value 6. You don't obtain the actual value 13 until you find out what is at that index in the sequence, by looking at s[6] (or in this case, *Iterator).