命名空间
变体
操作

std::uses_allocator<std::flat_set>

来自 cppreference.cn
< cpp‎ | container‎ | flat set
 
 
 
 
定义于头文件 <flat_set>
template< class Key, class Compare, class KeyContainer, class Allocator >

struct uses_allocator<std::flat_set<Key, Compare, KeyContainer>, Allocator>

    : std::bool_constant<std::uses_allocator_v<KeyContainer, Allocator>> {};
(since C++23)

std::uses_allocator 类型特征提供了 std::flat_set 的透明特化:容器适配器当且仅当底层容器使用分配器时才使用分配器。

目录

继承自 std::integral_constant

成员常量

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

成员函数

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

成员类型

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

[edit] 示例

#include <memory>
#include <flat_set>
 
static_assert(
    std::uses_allocator<std::flat_set<int>, void>::value == false &&
    std::uses_allocator<std::flat_set<int>, std::allocator<int>>::value == true
);
 
int main() {}

[edit] 参见

检查指定的类型是否支持 uses-allocator 构造
(类模板) [编辑]