Consider the simple program below, which attempts to iterate through the values of a set using NON-const references to the elements in it:
#include
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.