std::uses_allocator<std::tuple>
STD::用途[医]分配器<std::tuple>
Defined in header | | |
---|---|---|
template< class... Types, class Alloc > struct uses_allocator< std::tuple<Types...>, Alloc > : std::true_type { }; | | (since C++11) |
这种专业化std::uses_allocator
通知其他库组件元组支持用途分配器构造
,即使它们没有嵌套的allocator_type
...
继承自STD:积分[医]常量
成员常数
value static | true (public static member constant) |
---|
成员函数
operator bool | converts the object to bool, returns value (public member function) |
---|---|
operator() (C++14) | returns value (public member function) |
成员类型
Type | Definition |
---|---|
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.
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
二次
另见
uses_allocator (C++11) | checks if the specified type supports uses-allocator construction (class template) |
---|
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。