Can a reference type be used as the key type in an STL map

c++, containers, stl, types

Solution

According to C++ Standard 23.1.2/7 `key_type` should be assignable. Reference type is not.

Problem

Can I construct an `std::map` where the key type is a reference type, e.g. `Foo &` and if not, why not?

Original source