I’m not sure I understand why you would want to take a mutable argument but then never mutate it; for a future when you might want to?
This may be a case of library code vs application code. The reason why I would find it nice is that I’ve been working on large c++ codebases where sometimes things are const refereces and sometimes they are not. If they are not doesn’t mean they are actually mutated anywhere in the function. It would be nice if it was explicit.
With that said; how much protection does const
give you on a pointer?
If I take a *const Foo
where Foo
contains a *Bar
, would I then be able to mutate Bar
?