Does a C++ namespace alias defined inside a function definition have a block, function, file, or other scope (duration of validity)?
A:
It would have the scope of the block in which it was defined - likely to be the same as function scope unless you declare the alias inside a block within a function.
Jonathan Leffler
2009-09-30 01:02:17
A:
As far as I know, it's in the scope it's declared. So, if you alias in a method, then it's valid in that method, but not in another.
John Cavan
2009-09-30 01:04:03
+1
A:
The scope is the declarative region in which the alias is defined.
Reed Copsey
2009-09-30 01:04:07
+7
A:
It's a block duration of validity. E.g If you define a namespace alias as below, the namespace alias abc would be invalid outside {...} block.
{
namespace abc = xyz;
abc::test t; //valid
}
abc::test t; //invalid
rjoshi
2009-09-30 01:14:31
A:
adatapost
2009-09-30 01:18:30