Is there a better way to express nested namespaces in C++ within the header

前端 未结 11 2453
天涯浪人
天涯浪人 2020-12-13 03:31

I switched from C++ to Java and C# and think the usage of namespaces/packages is much better there (well structured). Then I came back to C++ and tried to use namespaces the

11条回答
  •  借酒劲吻你
    2020-12-13 03:59

    C++17 might simplify nested namespace definition:

    namespace A::B::C {
    }
    

    is equivalent to

    namespace A { namespace B { namespace C {
    } } }
    

    See (8) on namespace page on cppreference:
    http://en.cppreference.com/w/cpp/language/namespace

提交回复
热议问题