I've declared a structure like this ->
struct data{
int x,y;
bool operator < (const data& other) {
return x<other.x or y<other.y;
}
};
Now I want to map
it as a key and with a bool
value.
int main()
{
data a;
map<data,bool>mp;
a.x=12, a.y=24;
mp[a]=true;
}
The last line gives me this error ->
error: passing 'const' as 'this' argument of 'bool data::operator<(const data&)' discards qualifiers
How can I fix this ??