名稱空間
變體
操作

std::uses_allocator<std::flat_multimap>

來自 cppreference.com
 
 
 
 
在標頭檔案 <flat_map> 中定義
template< class Key, class T, class Compare,

          class KeyContainer, class MappedContainer, class Allocator >
struct uses_allocator<std::flat_multimap<Key, T, Compare,
                      KeyContainer, MappedContainer>, Allocator>
    : std::bool_constant<std::uses_allocator_v<KeyContainer, Allocator> &&

                         std::uses_allocator_v<MappedContainer, Allocator>> {};
(C++23 起)

提供了 std::uses_allocator 型別特徵對 std::flat_multimap 的透明特化:當且僅當底層容器使用分配器時,該容器介面卡才使用分配器。

目錄

繼承自 std::integral_constant

成員常量

value
[靜態]
true
(public static 成員常量)

成員函式

operator bool
將物件轉換為 bool,返回 value
(公開成員函式)
operator()
(C++14)
返回 value
(公開成員函式)

成員型別

型別 定義
value_type bool
型別 std::integral_constant<bool, value>

[編輯] 示例

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

[編輯] 參閱

檢查指定型別是否支援 uses-allocator 構造
(類模板) [編輯]