Maps on chains

(From a conversation with Vassil Vassilev.) Suppose we want to have a C++ map where the keys are disjoint, integer intervals of the form [ a , b ]: struct interval { int min, max; }; std::map<interval, std::string> m; m[{0, 9}] = "ABC"; m[{10, 19}] = "DEF"; This looks easy enough, we just have to write the proper comparison operator for intervals, right? bool operator<(const interval& x, const…