Hello
How can I define an operator for such:
bool operator<(my_class *l,my_class *r)
{
return l->_attribute < r->_attribute;
}
So that I can use with std::less, as:
std::set<my_class *, std::less<my_class*> > set1_t;
In VC++ compiler I get this error:
error C2803: 'operator <' must have at least one formal parameter of class
type.
It needs me to define the operator as:
bool operator<(my_class &l,my_class &r)
(It require me not to use pointers)
Please advise.
There is another solution is to write the comparator class and overload the
() operator.
Any other solutions?
--
Elias