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 的特化告诉其他库组件 tuples 支持使用分配器构造,即使它们无嵌套的 allocator_type.
继承自 std::integral_constant
成员常量
|    value [静态]  | 
   true   (公开静态成员常量)  | 
成员函数
|    operator bool  | 
   转换对象为 bool ,返回 value  (公开成员函数)  | 
|    operator() (C++14)  | 
   返回 value  (公开成员函数)  | 
成员类型
| 类型 | 定义 | 
  value_type
 | 
  bool
 | 
  type
 | 
std::integral_constant<bool, value> | 
示例
运行此代码
// myalloc 是带接收 int 的单参数构造函数的有状态分配器(Allocator)。 // 它无默认构造函数 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); // 对 v 的元素用分配器 #1 std::get<1>(v[0]).resize(10); // 对 innervector_t 用分配器 #2
 
参阅
|    (C++11)  | 
   检查指定的类型是否支持使用分配器的构造   (类模板)  |