-
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I wonder why is the less-than operator implemented such as to ignore the value, while the value is used in the equality operator? Strictly speaking types that implement the concept of equality need not necessarily implement less-than and vice-versa. It seems that the goal was to implement both operator via less-than over the fields.
The reason I'm asking this is practical: When adding Interval objects to sets or maps the behavior is different to adding them to an IntervalTree.
IntervalTree/include/intervaltree.hpp
Lines 108 to 119 in 1e4541b
| bool operator==(const Interval &other) const | |
| { | |
| return !(low < other.low || other.low < low | |
| || high < other.high || other.high < high | |
| || value < other.value || other.value < value); | |
| } | |
| bool operator<(const Interval &other) const | |
| { | |
| return (low < other.low || high < other.high); | |
| } |
Metadata
Metadata
Assignees
Labels
No labels