命名空间
变体
操作

std::uses_allocator<std::function>

来自 cppreference.cn
< cpp‎ | utility‎ | functional‎ | function
 
 
 
函数对象
函数调用
(C++17)(C++23)
恒等函数对象
(C++20)
透明运算符包装器
(C++14)
(C++14)
(C++14)
(C++14)  
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)

旧式绑定器和适配器
(直到 C++17*)
(直到 C++17*)
(直到 C++17*)
(直到 C++17*)  
(直到 C++17*)
(直到 C++17*)(直到 C++17*)(直到 C++17*)(直到 C++17*)
(直到 C++20*)
(直到 C++20*)
(直到 C++17*)(直到 C++17*)
(直到 C++17*)(直到 C++17*)

(直到 C++17*)
(直到 C++17*)(直到 C++17*)(直到 C++17*)(直到 C++17*)
(直到 C++20*)
(直到 C++20*)
 
 
定义于头文件 <functional>
template< class R, class... ArgTypes, class Alloc >
struct uses_allocator<std::function<R(ArgTypes...)>, Alloc> : std::true_type { };
(自 C++11 起)
(直到 C++17)

std::uses_allocator 的特化告知其他库组件:std::function 类型的所有对象均支持使用分配器构造,即使它们不含嵌套的 allocator_type

目录

[编辑] 注解

std::function 的分配器支持的规范不佳且实现不一致。一些实现完全不支持使用分配器构造,一些提供所需的构造函数重载但忽略所提供的分配器实参,而另一些则提供重载并在构造时使用所提供的分配器,但在重新赋值 std::function 时不使用。因此,分配器支持在 C++17 中被移除。

继承自 std::integral_constant

成员常量

value
[静态]
true
(公共静态成员常量)

成员函数

operator bool
将对象转换为 bool,返回 value
(公共成员函数)
operator()
(C++14)
返回 value
(公共成员函数)

成员类型

类型 定义
value_type bool
type std::integral_constant<bool, value>

[编辑] 参见

检查指定的类型是否支持使用分配器构造
(类模板) [编辑]