Robert Mason Robert Mason - 1 year ago 103
C++ Question

Multiple namespace declaration in C++

Is it legal to replace something like this:

namespace foo {
namespace bar {

with something like this:

namespace foo::bar {


Answer Source

You can combine namespaces into one name and use the new name (i.e. Foobar).

namespace Foo { namespace Bar {
    void some_func() {
        printf("Hello World.");

namespace Foobar = Foo::Bar;

int main()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download