为什么无序关联容器不使用<T> C++0x 中的allocator_traits
why unordered associative containers do not use allocator_traits<T> in C++0x
为什么c++ 0x无序关联容器不使用allocator_traits来定义其成员类型指针和const_pointer?
例如,顺序关联容器和有序关联容器使用以下定义:
typedef typename allocator_traits<Allocator>::pointer pointer;
typedef typename allocator_traits<Allocator>::const_pointer const_pointer;
而无序关联容器使用this:
typedef typename Allocator::pointer pointer;
typedef typename Allocator::const_pointer const_pointer;
我错过了什么?
我不认为你错过了什么。这是你参与标准制定过程的机会。请提交一个问题。关于如何这样做的说明在这里:
http://lwg.github.com/issues/lwg-active.html submit_issue
我扫描了,但没有找到关于这个主题的现有问题。
现在在最新的草案中更正了这一点。例如第788页:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3376.pdfclass unordered_set
{
public:
// types
.... .... ....
typedef typename allocator_traits<Allocator>::pointer pointer;
typedef typename allocator_traits<Allocator>::const_pointer const_pointer;
.... .... ....
}
有趣的是,en.cppreference.com(你可能会认为不正确)同意:http://en.cppreference.com/w/cpp/container/unordered_map
相关文章:
- EASTL矢量<向量<int>>连续的
- 定义宏以将前缀 0x 添加到十六进制字符串文本
- 0x%08lx 格式说明符在 printf 语句到 cout
- 如何使系统在十六进制数之前打印 0x,在八进制数之前打印 0?
- C - 创建矢量&lt; vector&lt; double&gt;&gt;矩阵具有分配而不是inizializ
- C 字符串比较“祝您好运”&gt;“再见”
- -std=c++0x 导致在 boost 1.64 的情况下返回对临时的引用
- 将字符串转换为十六进制格式并将"0x "附加到十六进制值
- 使用 C++0x 编译生成文件
- 为什么将此对向量&lt; map&lt; int,int&gt;&gt;中的地图进行更新.失败
- 如何将 x 打印为 0x,其中 x 是整数C++
- Unix 宏在使用 -std=c++0x 标志编译时变得未定义
- C :对矢量进行排序&lt; struct&gt;(结构有2个整数)基于结构的整数之一
- C 操作员&gt;&gt;与突变器过载
- 明确的专业化“ CheckIntmap&lt;&gt;”实例化
- 是否需要使用 - &gt;运算符在C 中调用成员函数时
- 什么是模板&lt;&gt;inline bla bla
- 编辑C Qlist&lt; object*&gt; gt;QML代码和一些QML警告中的模型
- eigen :: llt&lt;eigen :: matrixxd&gt;具有不完整的类型
- 错误,包括&lt; ctype&gt;在原子上使用C 11