Namespace aliases
提供: cppreference.com
![]() | このページは、Google 翻訳を使って英語版から機械翻訳されました。 翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
名前空間のエイリアスは、プログラマが名前空間の別名を定義することができます.
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.
彼らは一般的に長い、または深くネストされた名前空間のための便利なショートカットとして使用されている.
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.
目次 |
[編集]構文
namespace alias_name = ns_name; | (1) | ||||||||
namespace alias_name = :: ns_name; | (2) | ||||||||
namespace alias_name = nested_name:: ns_name; | (3) | ||||||||
[編集]説明
新しいエイリアスalias_nameは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は、以前に使用されていない名前でなければなりません。 alias_name、それが導入されたスコープの存続期間中にのみ有効です.
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.
[編集]例
このコードを実行します
#include <iostream> namespace foo {namespace bar {namespace baz {int qux =42;}}} namespace fbz = foo::bar::baz; int main(){std::cout<< fbz::qux<<'\n';}
出力:
42
[編集]参照
名前空間の宣言 | 名前空間を識別します 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. |