overloading comparison operators

Hello. If I overload comparison operators inside a class, it there any way to make the left hand argument const? say, I could make "a" const in the following code outside "somecls"
1
2
3
4
bool operator< (const somecls& a, const somecls& b)
{
    return a.value < b.value;
}

but if I define the operator inside the cls
1
2
3
4
bool somecls::operator< (const somecls& b)
{
    return value < b.value;
}

in this case, the calling class itself does not seem to be const. Is there a way to do that?

Thanks in advance!
closed account (D80DSL3A)
Yes there is:
1
2
3
4
bool somecls::operator< (const somecls& b) const
{
    return value < b.value;
}
Oooh! Right! Thank you!
Topic archived. No new replies allowed.