When I make a std::map
, what C++ expects from me is that my_data_type
has its own operator<
.
In order to find the element i
within the map, we have traversed to element e
the tree search will already have tested i < e
, which would have returned false.
So either you call i == e
or you call e < i
, both of which imply the same thing given the prerequisite of finding e
in the tree already. Since we already had to have an operator<
we don't rely on operator==
, since that would increase the demands of the key concept.