std::allocator_traits
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| 在头文件 <memory> 中定义
|
||
| template< class Alloc > struct allocator_traits; |
(C++11 起) | |
allocator_traits类模板提供了标准化的方式来访问各种属性的分配器。容器的标准和其他标准库组件可以访问通过此模板的分配,这使得它可以使用任何类类型的分配器,只要用户提供专业化的allocator_traits实现所需的所有功能.原文:
The
allocator_traits class template provides the standardized way to access various properties of allocators. The standard containers and other standard library components access allocators through this template, which makes it possible to use any class type as an allocator, as long as the user-provided specialization of allocator_traits implements all required functionality.默认情况下,非专业的,
allocator_traits包含以下成员:1原文:
The default, non-specialized,
allocator_traits contains the following members:目录 |
[编辑] 会员类型
| 类型
|
Definition |
allocator_type
|
Alloc |
value_type
|
Alloc::value_type |
pointer
|
Alloc::pointer(如果存在),否则value_type*
原文: Alloc::pointer if present, otherwise value_type* |
const_pointer
|
Alloc::const_pointer(如果存在),否则std::pointer_traits<pointer>::rebind<const value_type>
原文: Alloc::const_pointer if present, otherwise std::pointer_traits<pointer>::rebind<const value_type> |
void_pointer
|
Alloc::void_pointer(如果存在),否则std::pointer_traits<pointer>::rebind<void>
原文: Alloc::void_pointer if present, otherwise std::pointer_traits<pointer>::rebind<void> |
const_void_pointer
|
Alloc::const_void_pointer(如果存在),否则std::pointer_traits<pointer>::rebind<const void>
原文: Alloc::const_void_pointer if present, otherwise std::pointer_traits<pointer>::rebind<const void> |
difference_type
|
Alloc::difference_type(如果存在),否则std::pointer_traits<pointer>::difference_type
原文: Alloc::difference_type if present, otherwise std::pointer_traits<pointer>::difference_type |
size_type
|
Alloc::size_type(如果存在),否则std::make_unsigned<difference_type>::type
原文: Alloc::size_type if present, otherwise std::make_unsigned<difference_type>::type |
propagate_on_container_copy_assignment
|
Alloc::propagate_on_container_copy_assignment(如果存在),否则std::false_type
原文: Alloc::propagate_on_container_copy_assignment if present, otherwise std::false_type |
propagate_on_container_move_assignment
|
Alloc::propagate_on_container_move_assignment(如果存在),否则std::false_type
原文: Alloc::propagate_on_container_move_assignment if present, otherwise std::false_type |
propagate_on_container_swap
|
Alloc::propagate_on_container_swap(如果存在),否则std::false_type
原文: Alloc::propagate_on_container_swap if present, otherwise std::false_type |
[编辑] 会员别名模板
| 类型
|
Definition |
rebind_alloc<T>
|
Alloc::rebind<T>::other如果存在的话,否则Alloc<T, Args>的Alloc是Alloc<U, Args>
原文: Alloc::rebind<T>::other if present, otherwise Alloc<T, Args> if this Alloc is Alloc<U, Args> |
rebind_traits<T>
|
std::allocator_traits<rebind_alloc<T>> |
[编辑] 成员函数
| [静态的]</div></div>
|
分配未初始化的存储,使用分配器 原文: allocates uninitialized storage using the allocator (公共静态成员函数) |
| [静态的]</div></div>
|
释放存储使用分配器 原文: deallocates storage using the allocator (公共静态成员函数) |
| [静态的]</div></div>
|
构造一个对象分配的存储空间 原文: constructs an object in the allocated storage (函数模板) |
| [静态的]</div></div>
|
解构分配的存储空间中存储的对象 原文: destructs an object stored in the allocated storage (函数模板) |
| [静态的]</div></div>
|
返回对象的最大规模的分配器支持 原文: returns the maximum object size supported by the allocator (公共静态成员函数) |
| [静态的]</div></div>
|
获得分配器使用后复制一个标准集装箱 原文: obtains the allocator to use after copying a standard container (公共静态成员函数) |
[编辑] 另请参阅
| the default allocator (类模板) | |
| (C++11) |
实现多级的多级容器分配器 原文: implements multi-level allocator for multi-level containers (类模板) |
| (C++11) |
提供有关类似指针的类型的信息 原文: provides information about pointer-like types (类模板) |