This is an interview question.
Referring to the sample code, which one of the operators needs to be overridden in order to use
std::set<Value>
#include<iostream>
class Value
{
std::string s_val;
int i_val;
public:
Value(std::string s, int i): s_val(s) , i_val(i){}
};
// EOF
/*
a operator !=
b operator >
c operator <=
d operator >=
e operator <
*/
Actually, I do not understand why an operator needs to be overridden here. "set" does not allow duplicated elements, maybe operator != needs to be overridden ?
operator!=(oroperator==) it would be difficult to maintain the complexity guarantees, don't you think? Still I find this question sort of sad...