Espacios de nombres
Variantes
Acciones

std::uses_allocator<std::tuple>

De cppreference.com
< cpp‎ | utility‎ | tuple
 
 
Biblioteca de servicios
 
std::tuple
Funciones miembro
Funciones no miembro
(hasta C++20)(hasta C++20)(hasta C++20)(hasta C++20)(hasta C++20)(C++20)
Guías de deducción(C++17)
Clases asistentes
uses_allocator
 
Definido en el archivo de encabezado <tuple>
template< class... Types, class Alloc >
struct uses_allocator< std::tuple<Types...>, Alloc > : std::true_type { };
(desde C++11)
Esta especialización de std::uses_allocator informa a los otros componentes de la biblioteca que el apoyo tuplas' asignador de usos, la construcción, a pesar de que no tiene un allocator_type anidada .
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.

Contenido

Heredado de std::integral_constant

Constantes miembro

value
[estático]
true
(constante miembro pública estática)

Funciones miembro

operator bool
Convierte el objeto a bool, devuelve value.
(función miembro pública)
operator()
(C++14)
Devuelve value.
(función miembro pública)

Tipos miembro

Tipo Definición
value_type bool
type std::integral_constant<bool, value>

[editar] Ejemplo

// 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


[editar] Ver también

Comprueba si el tipo especificado admite construcción con uso de asignador.
(plantilla de clase) [editar]