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 d'espace de noms permettent au programmeur de définir un autre nom pour un espace de noms .
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.
Ils sont couramment utilisés comme un raccourci commode pour les espaces de noms longs ou profondément imbriquée .
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.
Sommaire |
[modifier] Syntaxe
namespace alias_name = ns_name;
|
(1) | ||||||||
namespace alias_name = :: ns_name;
|
(2) | ||||||||
namespace alias_name = nested_name:: ns_name;
|
(3) | ||||||||
[modifier] Explication
Le nouvel alias alias_name fournit une méthode alternative d'accéder 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 doit être un nom qui n'est pas déjà utilisé. alias_name est valable pour la durée de l'étendue dans laquelle elle est introduite .
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.
[modifier] Exemple
#include <iostream> namespace foo { namespace bar { namespace baz { int qux = 42; } } } namespace fbz = foo::bar::baz; int main() { std::cout << fbz::qux << '\n'; }
Résultat :
42
[modifier] Voir aussi
déclaration d'espace | identifie un espace de noms
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. |