[SG10] N4230 Nested namespace definition

Nelson, Clark clark.nelson at intel.com
Mon Mar 23 23:24:07 CET 2015


The name __cpp_nested_namespace_definitions seems pretty obvious and
non-controversial.

But I don't think we've actually considered whether a new macro would be
justified. How would a reasonable person write code that works both with and
without this feature?

#if __cpp_nested_namespace_definitions
#define NND(x) x::
#else
#define NND(x)
#endif

#if !__cpp_nested_namespace_definitions
namespace X { namespace Y {
#endif
void NND(X::Y) f()
{
}
#if !__cpp_nested_namespace_definitions
}}
#endif

Is it plausible that someone would write code like that? If they cared about
portability to C++14, would they be more likely to just ignore this new
feature, and write their code the old way?

Clark


More information about the Features mailing list