So I'm very confused on why I'm getting an error here. I've dumbed down my code for simplicity and removed irrelevant code. Hopefully it doesn't take away the issue.
PHP Code:
class Foo
{
public:
bool IsNull() const;
private:
std::map<int, int*> test;
}
bool Foo::IsNull() const
{
if (test[0] == 0)
return true;
else
return false;
}
I'm getting a "passing...discards qualifiers" error on my if statement and not sure why because I'm not changing anything. I know removing const or making test mutable fixes the issue. I've been taught to always make a function const if it doesn't change anything, in which case, have I finally come across an acceptable time to use mutable?