名前空間
変種
操作

std::uses_allocator<std::tuple>

From cppreference.com
< cpp‎ | utility‎ | tuple
 
 
ユーティリティライブラリ
言語サポート
型のサポート (基本型、RTTI)
ライブラリ機能検査マクロ (C++20)
プログラムユーティリティ
可変引数関数
コルーチンサポート (C++20)
契約サポート (C++26)
三方比較
(C++20)
(C++20)(C++20)(C++20)  
(C++20)(C++20)(C++20)

汎用ユーティリティ
関係演算子 (C++20で非推奨)
 
 
ヘッダ <tuple> で定義
template< class... Types, class Alloc >
struct uses_allocator< std::tuple<Types...>, Alloc > : std::true_type { };
(C++11以降)

このstd::uses_allocatorの特殊化は、タプルがネストされたallocator_typeを持っていなくても、タプルがuses-allocator構築をサポートしていることを他のライブラリコンポーネントに通知します。

目次

std::integral_constant から継承

メンバ定数

value
[static]
true
(公開静的メンバ定数)

メンバ関数

operator bool
オブジェクトを bool に変換し、value を返します。
(public member function)
operator()
(C++14)
value を返します。
(public member function)

メンバ型

定義
value_type bool
type std::integral_constant<bool, value>

[編集]

// myalloc is a stateful Allocator with a single-argument constructor
// that takes an int. It has no default constructor.
 
    using innervector_t = std::vector<int, myalloc<int>>;
    using elem_t = std::tuple<int, innervector_t>;
    using Alloc = std::scoped_allocator_adaptor< myalloc<elem_t>, myalloc<int>>;
 
    Alloc a(1,2);
    std::vector<elem_t, Alloc> v(a);
    v.resize(1);                  // uses allocator #1 for elements of v
    std::get<1>(v[0]).resize(10); // uses allocator #2 for innervector_t

[編集] 関連項目

指定された型が uses-allocator 構築をサポートしているかどうかをチェックします
(クラステンプレート) [編集]
English 日本語 中文(简体) 中文(繁體)