January 27th, 2012, 02:21 PM
Map Comparison Fails in Function Const
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.
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?
bool IsNull() const;
std::map<int, int*> test;
bool Foo::IsNull() const
if (test == 0)
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!