Suppose I have a custom string like type:
struct MyType {
std::string str_;
int somethingElse;
}
Now, I know how to make it usuable in a std::set - just supply <
operator.
How can I use it with a std::unordered_set
? when it is supposed to be based on the std::string str_
member ?
std::unordered_set<MyType> um;
Update: I have already seen this answer: C++ unordered_map using a custom class type as the key
It looks somewhat outdated(c++11 ?) and also concerns map