Namespace
Varianti

std::tuple_size<std::tuple>

Da cppreference.com.
< cpp‎ | utility‎ | tuple

 
 
Utilità libreria
Tipo di supporto (basic types, RTTI, type traits)
Gestione della memoria dinamica
La gestione degli errori
Programma di utilità
Funzioni variadic
Data e ora
Funzione oggetti
initializer_list(C++11)
bitset
hash(C++11)
Gli operatori relazionali
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Coppie e tuple
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
Swap, in avanti e spostare
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
std::tuple
Membri funzioni
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tuple::tuple
tuple::operator=
tuple::swap
Non membri funzioni
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
make_tuple
tie
forward_as_tuple
None
operator=
operator!=
operator<
operator<=
operator>
operator>=
std::swap
get
Helper classi
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tuple_size
tuple_element
uses_allocator
ignore
 
Elemento definito nell'header <tuple>
template< class T >
class tuple_size; /*undefined*/
(1) (dal C++11)
template< class... Types >

class tuple_size<tuple<Types...> >

 : public std::integral_constant<std::size_t, sizeof...(Types)> { };
(2) (dal C++11)
template< class T >

class tuple_size<const T>
 : public std::integral_constant<
             typename std::remove_cv<decltype(std::tuple_size<T>::value)>::type,

             std::tuple_size<Tp>::value> { };
(3) (dal C++11)
template< class T >

class tuple_size< volatile T >
 : public std::integral_constant<
             typename std::remove_cv<decltype(std::tuple_size<T>::value)>::type,

             std::tuple_size<Tp>::value> { };
(4) (dal C++11)
template< class T >

class tuple_size< const volatile T >
 : public std::integral_constant<
             typename std::remove_cv<decltype(std::tuple_size<T>::value)>::type,

             std::tuple_size<Tp>::value> { };
(5) (dal C++11)
Consente di accedere al numero di elementi in una tupla come un tempo di compilazione espressione costante.
Original:
Provides access to the number of elements in a tuple as a compile-time constant expression.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Indice

Inherited from std::integral_constant

Member constants

value
[statico]
sizeof...(Types)
(pubblico membro statico costante)

Member functions

operator std::size_t
converte l'oggetto in std::size_t, restituisce value
Original:
converts the object to std::size_t, returns value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(metodo pubblico)

Member types

Tipo
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 std::size_t
type std::integral_constant<std::size_t, value>

[modifica] Esempio

#include <iostream>
#include <tuple>
 
template<class T>
void test(T t)
{
    int a[std::tuple_size<T>::value]; // can be used at compile time
    std::cout << std::tuple_size<T>::value << '\n'; // or at run time
}
 
int main()
{
    test(std::make_tuple(1, 2, 3.14));
}

Output:

3

[modifica] Vedi anche

ottiene la dimensione di un array
Original:
obtains the size of an array
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe modello di specializzazione) [modifica]
ottiene la dimensione di un pair
Original:
obtains the size of a pair
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe modello di specializzazione) [modifica]
tupla accede elemento specificato
Original:
tuple accesses specified element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(funzione di modello) [modifica]
ottiene il tipo dell'elemento specificato
Original:
obtains the type of the specified element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe modello di specializzazione) [modifica]