Ok, I hate const, it's a pain in the ass. Say you have a const object and you want to use one of it's methods to access a members. Normally, you can do this, but if the object is a const reference of another object and you want to access a method of that const ref, you have to copy it into an object before you can.
Example:
Code: Select all
class Bounds
{
public:
// const int Left() doesn't work either
int Left()
{
return left;
}
private:
int left;
};
class Object
{
public:
const Bounds& GetBounds() // can't const the function, because I'm calling a non const function
{
bounds.Update(Position, size);
return bounds;
}
};
There is a snippet of the classes I have. Now if I want to call Left() from outside the Object class, in the Game class for instance
it tells me that the "object has type qualifiers that are not compatible with the member function. I can't make the Bounds object const because the boundaries will change as the object moves. Even making the returned value of Left() const doesn't work.
Using const may make sense most of the time, but sometimes, it's just a pain in the ass to work with.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com