C++ namespace alias in entire class scope

后端 未结 4 1182
庸人自扰
庸人自扰 2021-02-02 07:33

I expected to be able to use a namespace alias in a class declaration but get a compiler syntax error.

struct MyClass
{
    namespace abc = a_big_namespace;
             


        
4条回答
  •  野性不改
    2021-02-02 08:02

    You can of course also put the alias outside the class:

    namespace abc = a_big_namespace;     
    
    struct MyClass {
        void fn()
        { abc::test(); } 
    }; 
    

提交回复
热议问题