Does a C++ namespace alias defined inside a function definition have a block, function, file, or other scope (duration of validity)?
What is the scope of a namespace alias?
5.3k views Asked by EmpireJones At
7
There are 7 answers
0
On
I'm fairly certain that a namespace alias only has scope within the block it's created in, like most other sorts of identifiers. I can't check for sure at the moment, but this page doesn't seem to go against it.
1
On
It is valid for the duration of the scope in which it is introduced.
Take a look at http://en.cppreference.com/w/cpp/language/namespace_alias, I trust the explanation of cppreference, it's much more standard.
It's a block duration of validity.
For example: If you define a namespace alias as below, the namespace alias abc would be invalid outside the
{...}-block.