On Aug 6, 2013, at 2:53 PM, Sebastian Redl <[email protected]> 
wrote:

> 
> On 06.08.2013, at 17:40, Howard Hinnant wrote:
> 
>> This behavior mimics the defined/undefined behavior for pointers described 
>> in [expr.eq] and [expr.rel].  j1 and j2 point to the same object, so they 
>> are both equality comparable and less-than comparable.  i1, i2 both point to 
>> different objects (none at all), and not to the same object as j1 and j2.  
>> [expr.eq] says that all pointers are equality comparable, and this is 
>> reflected in the above test.  However [expr.rel] defines operator<() only 
>> for pointers pointing into the same object.
> 
> But comparison between pointers into different objects is unspecified, not 
> undefined. I don't think trapping is a valid outcome.

Do you think debug mode would be more helpful, or less helpful, if the 
relational operators trapped a less-than comparison between two iterators i and 
j where i and j belong to two different vectors?

If more helpful, then I think we don't care about bending the rules in debug 
mode.  It won't be the first rule bent.  For example vector swap is no longer 
O(1) either.  Otoh, if you've got (or anyone else has) a motivating use case 
where such a comparison is useful, then I should remove the trap.

Howard

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to