Palavras-chave do C++: typename
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
Uso
- Numa modelo de classe ou modelo de função,
typenamepode ser usado como uma alternativa para classe declarar tipos templated.Original:In a modelo de classe or modelo de função,typenamecan 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. - Dentro de uma definição de modelo,
typenamepode ser usado para declarar que um nome dependente é um tipo.Original:Inside a template definition,typenamecan 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.
Exemplo
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();
}