You are right, since they do not change the actual state of the object itself, you can choose.
While there is no hard and fast rule, โusing const where possibleโ is definitely not a universal way. Refer to functions like std::vector::operator[] & mdash, which do not change the members of the vector object, but fixed objects provide a non- const version (and a different version of const ).
One good way to take a look at this: suppose you have a BufferObject , and you pass it to a function that takes const BufferObject& . Will this ruin your expectations (the invariants you expect to spend) if this function calls dataStore() ? If so, do not dataStore() as const .
To answer your specific case, I think you are right and should leave these functions not const . Although they do not alter the physical contents of a C ++ object, they alter the logical state of the object represented by this C ++ object.
Angew source share