Note. This question is not of a general nature. Full ordering on pointers of the same type can be obtained using std::less .
Accordingly, comparing two pointers with operator< not allowed if they point, for example, to different distributions.
In what sense is it prohibited? Is the implementation defined, undefined, or undefined behavior?
I think I read somewhere that it is not listed. Implementation is not required to document behavior, but there must be some kind of behavior. Thus, this means that comparing any two pointers is still legal, but does not necessarily give a general order. Does this mean that we should still get a consistent result when comparing two of the same two pointers twice? . In the general case: does the same unspecified behavior cause twice in the application, always gives the same result
int i1, i2; int* a = &i1; int* b = &i2; bool b1 = a < b; // unspecified, right? bool b2 = a < b; assert(b1 == b2); // Is this guaranteed to be true?
source share