std::uses_allocator<std::tuple>
提供: cppreference.com
ヘッダ <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 [静的] | true (パブリック静的メンバ定数) |
メンバ関数
operator bool | オブジェクトを bool に変換します。 value を返します (パブリックメンバ関数) |
operator() (C++14) | value を返します (パブリックメンバ関数) |
メンバ型
型 | 定義 |
value_type | bool |
type | std::integral_constant<bool, value> |
[編集]例
Run this code
// myalloc is a stateful Allocator with a single-argument constructor// that takes an int. It has no default constructor. typedefstd::vector<int, myalloc<int>> innervector_t;typedefstd::tuple<int, innervector_t> elem_t;typedefstd::scoped_allocator_adaptor< myalloc<elem_t>, myalloc<int>> Alloc; 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
[編集]関連項目
(C++11) | 指定された型がアロケータ使用構築をサポートしているかどうか調べます (クラステンプレート) |