InputStream and OutputStream non const getPosition

Hi Jules,

Is there a reason why getPosition in InputStream and OutputStream
is not a const function ?


I always prefer to make things const, but there could be all sorts of stream subclasses that might need to use that in a non-const way. e.g. a subclass might want to cache the position when it’s called.

I admit, it could probably be const and not break anything, but it’s just to avoid being a problem in future.

usually you will use mutable in that case.

my 2 cents.

True. I’m not saying it’s right or wrong - that’s just how I wrote that class (a long time ago now!) If I changed it, every subclass would have to update their methods. Maybe I’ll make it const, I don’t know…

No problem.
I understand easily.