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
,它們也支援*uses-allocator 構造*。
目錄 |
繼承自 std::integral_constant
成員常量
value [靜態] |
true (public static 成員常量) |
成員函式
operator bool |
將物件轉換為 bool,返回 value (公開成員函式) |
operator() (C++14) |
返回 value (公開成員函式) |
成員型別
型別 | 定義 |
value_type
|
bool |
型別
|
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
[編輯] 另請參閱
(C++11) |
檢查指定型別是否支援 uses-allocator 構造 (類模板) |