std::uses_allocator<std::tuple>
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <tuple>
|
||
| template< class... Types, class Alloc > struct uses_allocator< std::tuple<Types...>, Alloc > : std::true_type { }; |
(C++11 起) | |
這種專業化的std::uses_allocator通知其他庫組件的元組支持的「使用分配器建設的」,即使他們沒有一個嵌套的
allocator_type.Original:
This specialization of std::uses_allocator informs other library components that tuples support uses-allocator construction, even though they do not have a nested
allocator_type.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目錄 |
Inherited from std::integral_constant
Member constants
| value [靜態的] </ SPAN></div></div>
|
true (公共靜態成員常量) |
Member functions
| operator bool |
轉換的對象bool,返回 value Original: converts the object to bool, returns value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成員函數) |
Member types
| 類型
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
bool
|
type
|
std::integral_constant<bool, value> |
</div>
[编辑] 為例
// myalloc is a stateful Allocator with a single-argument constructor // that takes an int. It has no default constructor. typedef std::vector<int, myalloc<int>> innervector_t; typedef std::tuple<int, innervector_t> elem_t; typedef std::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) |
檢查如果指定的類型支持使用分配器建設的 Original: checks if the specified type supports uses-allocator construction The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (類模板) |