“cpp/container/queue/uses allocator”的版本间的差异
来自cppreference.com
TranslationBot(讨论 | 贡献) (Translated from the English version using Google Translate) |
小 (1个修订: Translate from the English version) |
2012年10月25日 (四) 14:22的版本
在标头 <queue> 定义
|
||
template< class T, class Container, class Alloc > struct uses_allocator<std::queue<T, Container>, Alloc> |
(C++11 起) | |
为 std::queue 提供 std::uses_allocator 类型特征的透明特化:当且仅当底层容器使用分配器时,容器适配器使用分配器。
目录 |
继承自 std::integral_constant
成员常量
value [静态] |
true (公开静态成员常量) |
成员函数
operator bool |
将对象转换到 bool,返回 value (公开成员函数) |
operator() (C++14) |
返回 value (公开成员函数) |
成员类型
类型 | 定义 |
value_type
|
bool |
type
|
std::integral_constant<bool, value> |
示例
运行此代码
#include <memory> #include <queue> static_assert( std::uses_allocator<std::queue<int>, void>::value == false && std::uses_allocator<std::queue<int>, std::allocator<int>>::value == true ); int main() {}
参阅
(C++11) |
检查指定的类型是否支持使用分配器的构造 (类模板) |