<div class="t-tr-text">C + +: le parole chiave<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">C++ keywords:</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div> typename
![]() |
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. |
[modifica] Utilizzo
- In un classe template o funzione di modello, typename può essere utilizzata come alternativa al classe per dichiarare tipi templated.Original:In a classe template or funzione di modello, typename can be used as an alternative to classe to declare templated types.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - All'interno della definizione di template, typename può essere utilizzato per dichiarare che un nome dipendente è un tipo.Original:Inside a template definition, typename can be used to declare that a dependent name is a type.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Esempio
template <typename T> void foo (const std::vector<T> &v) { // std::vector<T>::const_iterator is a dependent name, // so using it as a type requires the addition of the // typename keyword typename std::vector<T>::const_iterator it = v.begin(); }