This post raised a question of the absence of >
, <
.. comparison operators for unordered containers in C++. From the reply it looks meaningless to have those.
However, I checked Python and see that set
type supports subset and superset operations. Python set
is a hash table. We can easily do:
{'1', '6', 't', 'j'} > {'1', '6', 'j'} # superset
True
{'1', '6', 'j', 't'} < {'1', '6', 'j'} # subset
False
How to implement comparison operators in C++ for hash table (std::unordered_set
)? Or we do have to stick to std::set
for any comparison other than equality?