Sunday, 8 September 2013

Unordered Map equality functionality c++

Unordered Map equality functionality c++

May be this is easy but I just want to understand if we can do this:
Let say we have an unordered_map(string, string) so by default it will
check for equality if two strings are equal.
Now, let say if we add one more functionality in equality operator that
even if two strings are anagrams of each other then also return true. In
order to this, can we only update the equality operator and not the
hasher(and use the default hasher).
For instance, only defining functor for:
bool operator() (const string& a, const string& b) const
{
// check for anagram condition here
}

No comments:

Post a Comment