Namespace aliases
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. |
Alias de espacios de nombres permiten al programador definir un nombre alternativo para un espacio de nombres .
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.
Son de uso general como un atajo conveniente para los espacios de nombres largos o profundamente anidado .
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.
Contenido |
[editar] Sintaxis
namespace alias_name = ns_name;
|
(1) | ||||||||
namespace alias_name = :: ns_name;
|
(2) | ||||||||
namespace alias_name = nested_name:: ns_name;
|
(3) | ||||||||
[editar] Explicación
El nuevo alias alias_name proporciona un método alternativo de acceso 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 debe ser un nombre no utilizado previamente. alias_name es válida para la duración del ámbito en el que se introduce .
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] Ejemplo
#include <iostream> namespace foo { namespace bar { namespace baz { int qux = 42; } } } namespace fbz = foo::bar::baz; int main() { std::cout << fbz::qux << '\n'; }
Output:
42
[editar] Ver también
espacio de nombres declaración | identifica un espacio de nombres
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. |