std::remove_all_extents
Da cppreference.com.
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <type_traits> | ||
template<class T > struct remove_all_extents; | (dal C++11) | |
Se
T
è un array multidimensionale di qualche X
tipo, fornisce l'elemento di typedef type
pari a X
, altrimenti type
è T
.Original:
If
T
is a multidimensional array of some type X
, provides the member typedef type
equal to X
, otherwise type
is T
.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.
Indice |
[modifica]Membri tipi
Nome Original: Name The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | Definition |
type | il tipo dell'elemento di T Original: the type of the element of T The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica]Possibile implementazione
template<class T>struct remove_all_extents {typedef T type;}; template<class T>struct remove_all_extents<T[]>{typedeftypename remove_all_extents<T>::type type;}; template<class Tp, std::size_t N>struct remove_all_extents<T[N]>{typedeftypename remove_all_extents<T>::type type;}; |
[modifica]Esempio
#include <iostream>#include <type_traits>#include <typeinfo> template<class A>void foo(const A&){typedeftypename std::remove_all_extents<A>::type Type;std::cout<<"underlying type: "<<typeid(Type).name()<<'\n';} int main(){float a1[1][2][3];int a2[3][2];float a3[1][1][1][1][2];double a4[2][3]; foo(a1); foo(a2); foo(a3); foo(a4);}
Output:
underlying type: f underlying type: i underlying type: f underlying type: d
[modifica]Vedi anche
(C++11) | Verifica se un tipo è un tipo di matrice Original: checks if a type is an array type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |
(C++11) | ottiene il numero di dimensioni di un tipo di matrice Original: obtains the number of dimensions of an array type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |
(C++11) | ottiene la dimensione di un tipo di matrice lungo una dimensione specificata Original: obtains the size of an array type along a specified dimension The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |
(C++11) | rimuove una misura dal tipo di matrice specificato Original: removes one extent from the given array type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |