std::uses_allocator<std::flat_map> - cppreference.com
来自cppreference.com
template< class Key, class T, class Compare, class KeyContainer, class MappedContainer, class Allocator > struct uses_allocator<std::flat_map<Key, T, Compare, KeyContainer, MappedContainer>, Allocator> : std::bool_constant<std::uses_allocator_v<KeyContainer, Allocator> && std::uses_allocator_v<MappedContainer, Allocator>> {}; |
(C++23 起) | |
为 std::flat_map 提供 std::uses_allocator 类型特征的透明特化:当且仅当底层容器使用分配器时,容器适配器使用分配器。
继承自 std::integral_constant
成员常量
true (公开静态成员常量) |
成员函数
将对象转换到 bool,返回 value (公开成员函数) | |
返回 value (公开成员函数) |
成员类型
| 类型 | 定义 |
value_type
|
bool
|
type
|
std::integral_constant<bool, value>
|
示例
#include <memory> #include <flat_map> static_assert( std::uses_allocator<std::flat_map<int, int>, void>::value == false && std::uses_allocator<std::flat_map<int, int>, std::allocator<int>>::value == true ); int main() {}