The following:
std::map<int, ClassA &> test;
gives:
error C2101: '&' on constant
While the following
std::map<ClassA &, int> test;
gives
error C2528: '_First' : pointer to reference is illegal
The latter seems like map cannot contain a reference for the key value, since it needs to instantiate the class sometimes and a reference cannot be instantiated without an object. But why does the first case not work?
See Question&Answers more detail:os