Consider this code example:
#include
#include
using namespace std;
set string_set;
void foo(const string& a)
{
From the standard :
23.3.3
A set is a kind of associative container that supports unique keys (contains at most one of each key value) and provides for fast retrieval of the keys themselves. Class set supports bidirectional iterators.
This is also from the standard :
typedef implementation defined
iterator;
// See 23.1
The real implementation of set::iterator is a constant iterator in order to keep the requirement to have unique keys. Otherwise you could change the values in set to all the same values.