I am trying to create a set using a custom == operator for the set::insert function.
the case is i have an object with 2 members - Source, Target.
The objects == operator looks like this:
bool Object::operator==(const Object& other) const{
if (m_first == other.first() && m_second == other.second()) {
return true;
}
if (m_first == other.second() && m_second == other.first()) {
return true;
}
return false;
}
For the specific set i need it to act differently, return true only when
m_first==other.m_first && m_second==other.m_second
according to the std::reference i can only create a set using a custom compare function for weak strict ordering, which is not the case.
I cannot edit the original function, as this behavior is needed in other place in the code.
Right now i am using a vector for a workaround, but i am looking for a simpler more readable solution.
Thank you