How can I “unuse” a namespace?

Nope. But there’s a potential solution: if you enclose your include directive in a namespace of its own, like this…

namespace codegear {
    #include "codegear_header.h"
} // namespace codegear

…then the effects of any using directives within that header are neutralized.

That might be problematic in some cases. That’s why every C++ style guide strongly recommends not putting a “using namespace” directive in a header file.

Leave a Comment