I am trying to overload operator <<
, but it always need to be a const
function. However, I want to change values inside this overloaded function
You're likely doing something wrong then. Post the relevant bits of your code, along with a better summary of what your trying to do, and you'll get more help.
That being said, if you need to modify some data in a const object, there are a couple things you can do:
mutable
.const_cast<...>(...)
to remove the const modifier from the passed in object.But most likely you're trying to do something the wrong way.