Possible Duplicate:
Why does stack<const string> not compile in g++?
An answer to another question
explained why we (supposedly) can't have containers of const
objects. For example, this is not allowed:
vector<const int> v; //not allowed
But why does a pair
allow the first object to be const
? This is, indeed, what happens with the pair
s inside a map
object. Am I missing something?
Detailed and intuitive explanations of this phenomenon would be greatly appreciated.