Namespace aliases
Da 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. |
Aliases namespace permitem ao programador definir um nome alternativo para um namespace.
Original:
Namespace aliases allow the programmer to define an alternate name for a namespace.
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.
Eles são comumente usados como um atalho conveniente para namespaces longas ou profundamente aninhada.
Original:
They are commonly used as a convenient shortcut for long or deeply-nested namespaces.
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.
Índice |
[editar] Sintaxe
namespace alias_name = ns_name;
|
(1) | ||||||||
namespace alias_name = :: ns_name;
|
(2) | ||||||||
namespace alias_name = nested_name:: ns_name;
|
(3) | ||||||||
[editar] Explicação
O novo alias alias_name fornece um método alternativo de acessar ns_name.
Original:
The new alias alias_name provides an alternate method of accessing ns_name.
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.
alias_name deve ser um nome não utilizado anteriormente. alias_name é válido para o período de duração do âmbito em que são introduzidos.
Original:
alias_name must be a name not previously used. alias_name is valid for the duration of the scope in which it is introduced.
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.
[editar] Exemplo
#include <iostream> namespace foo { namespace bar { namespace baz { int qux = 42; } } } namespace fbz = foo::bar::baz; int main() { std::cout << fbz::qux << '\n'; }
Saída:
42
[editar] Veja também
declaração de namespace | identifica um namespace
Original: identifies a namespace The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |