
On Sep 30, 2011, at 12:29 PM, Andrew Sutton wrote:
Well, two anyways: == and !=. Given that the standard doesn't allow those on singular-valued iterators, you're right. I think the standard is a little too strict, here.
The underlying values that would need to be compared are potentially "trap" values (c.f. C++99/6.2.6/5). Present commodity hardware typically leads toward different representation requirements for explicitly capturing things like the existance of uninitialized data, resulting in runtime distinctions between normal and debug iterators, for example. However, there has existed (and may still, or may again in the future) hardware implementations which provided direct support for this sort of thing, potentially giving one improved error checking directly by, for example, producing a hardware exception any time a trap value is read. This sort of thing might even be accomplished with present commodity hardware, by doing things like fiddling with parity bits. The standard even alludes to such an approach; see C++99 footnote 44. I would guess that the standard is written the way it is in the area under discussion specifically to support various error checking approaches such as these, and disagree that the standard is too strict in this area.