Can a reference type be used as the key type in an STL map(引用类型可以用作 STL 映射中的键类型吗)
问题描述
Can I construct an std::map
where the key type is a reference type, e.g. Foo &
and if not, why not?
According to C++ Standard 23.1.2/7 key_type
should be assignable. Reference type is not.
这篇关于引用类型可以用作 STL 映射中的键类型吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!