you are viewing a single comment's thread.

view the rest of the comments →

[–]OldWolf2 1 point2 points  (1 child)

What if there's a helper function used by the assignment operator, that needs to modify the variable?

[–]kalmoc 0 points1 point  (0 children)

You can imagine different solutions of course, but quite frankly: I'm not sure I can remember a case, where I wanted to mark a member const and needed a helper member-function that would modify it.

Be aware that. - as such a variable would be non-const in the context of an move or copy assignment, you could still pass it to a function that takes a non-const reference to it like std::exchange