I'm writing a class which is unmodifiable from outside. It is not 'immutable' since it modifies the contents inside.
I want it to be a Container
-interface-compliant container; it can't be Container
anyway since it doesn't have a default constructor.
What i'm wondering is, "Should I provide iterator
?."
The easiest way is to set iterator
to be the same with const_iterator
, but I found that lots of people try to iterate a container through iterator
, not const_iterator
even if they don't modify the value while iterating.
Will it be meaningful providing iterator
which can't modify the value?