Nested namespace declarations
I suggest to extend syntax of nested namespace declarations and provide alternative way similar to one implemented in C#:
namespace Outer::Inner // declares nested namespace
{
struct Foo
{
};
}
Outer::Inner::Foo foo;
That would be useful for codebases with high usage of nested namespaces especially with level of depth 3 or more.

As noted below, this has been supported since Visual Studio 2015 Update 3. To stay up-to-date with our work on C++ conformance, check out this blog post: https://blogs.msdn.microsoft.com/vcblog/2017/03/07/c-standards-conformance-from-microsoft/
Thank you for your suggestion. We’re marking this suggestion as complete!
— Visual C++ Team
11 comments
-
Anonymous commented
Should be closed, this is already implemented in Visual Studio 2017 and as mentioned below in the newest 2015.
-
Paul M commented
Yup this is now complete in 2015 update 3!
-
Claude Adrian commented
-
David Hunter commented
Sadly no in VS 15 Preview
-
Paul M commented
+1 now that this is standard see N4230
-
David Hunter commented
Nested namespace, http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4230.html, were adopted at the 2014 Urbana ISO meeting as noted here https://isocpp.org/blog/2014/11/trip-report-fall.
VS2015 RC does not support them as noted here http://blogs.msdn.com/b/vcblog/archive/2015/04/29/c-11-14-17-features-in-vs-2015-rc.aspx
-
Sebastian Redl commented
This will most likely be in C++17 and is supported in Clang as of a few days ago.
-
SC commented
It would be silly to add a gratuitous incompatibility. If nesting is a problem, just use
namespace Outer { namespace Inner {
...
} } -
Anonymous commented
Can we request MS to bring this up to the standard committé? I agree with previous comments that unless this is standard c++ it is inappropriate, but I would love(!) it to be standard...
-
Ben Voigt commented
I agree with John, I actively thumbs down this request. The idea isn't totally bad, but having it in Visual C++ and not in the Standard would be terrible. Visual C++ UserVoice is not where this request should start -- go present it to the C++14 Standards committee.
-
John M. Długosz commented
Can we vote _against_ something?
I don't want gratuitous incompatibilities between VS-only code and the C++ standard. People might use them without realizing it.