【发布时间】:2011-02-06 12:07:14
【问题描述】:
C++ 标准中有 this other question asking about how comparing pointers is supposed to be interpreted。
所以我想知道 C++ Std 对在有序标准库 (STL) 容器中使用指针作为键有什么看法——即是否允许拥有
std::map<T1*, T2>
这是由于std::less 或builtin operator < 的规范造成的吗?
【问题讨论】:
-
顺便说一句,你想使用地址作为键还是它们指向的东西的值作为键?在后一种情况下,您必须提供自定义比较器
标签: c++ pointers standards containers