Namespaces
Variants

std:: uses_allocator <std::tuple>

From cppreference.net
Utilities library
ヘッダーで定義 <tuple>
template < class ... Types , class Alloc >
struct uses_allocator < std:: tuple < Types... > , Alloc > : std:: true_type { } ;
(C++11以降)

この特殊化は、 std::uses_allocator が、タプルがネストされた allocator_type を持たないにもかかわらず、 アロケータ使用構築 をサポートすることを他のライブラリコンポーネントに通知します。

目次

std:: integral_constant からの継承

メンバ定数

value
[static]
true
(public static member constant)

メンバ関数

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

メンバ型

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

// myallocは単一引数のコンストラクタを持つステートフルなAllocator
// このコンストラクタはintを引数に取る。デフォルトコンストラクタは持たない。
    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);                  // vの要素に対してアロケータ#1を使用
    std::get<1>(v[0]).resize(10); // innervector_tに対してアロケータ#2を使用

関連項目

指定された型がuses-allocator構築をサポートするかどうかをチェックする
(クラステンプレート)