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
From the cpp reference:
In a set, the value of an element also identifies it (the value is itself the key, of type T), and each value must be unique. The value of the elements in a set cannot be modified once in the container (the elements are always const), but they can be inserted or removed from the container.