Quick A: A set does not allow the modification of its keys.
Recently on SO:
Why does std::set seem to force the use of a const_iterator?
A set is like a map with no values, only keys. Since those keys are used for a tree that accelerates operations on the set, they cannot change. Thus all elements must be const to keep the constraints of the underlying tree from being broken.
Add a Comment
Comments are closed.