How can I “unuse” a namespace?

后端 未结 7 2293
庸人自扰
庸人自扰 2020-11-29 03:01

One of the vagaries of my development system (Codegear C++Builder) is that some of the auto-generated headers insist on having...

using namespace xyzzy
         


        
7条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 03:52

    No you can't unuse a namespace. The only thing you can do is putting the using namespace-statement a block to limit it's scope.

    Example:

    {
        using namespace xyzzy;
    
    } // stop using namespace xyzzy here
    

    Maybe you can change the template which is used of your auto-generated headers.

提交回复
热议问题