Basically, I am working with some provided header files with the following format:
#include <iostream>
using namespace std;
class bar
{
public:
void printSomething(void)
{
cout << "This is an example." << endl;
}
}
My question is, since I can't modify the provided header, how do I strip the std
namespace in my files and go back to the default global namespace? I have tried "using namespace ::;
" and "using namespace ;
", but the the compiler isn't happy with either of those. Any ideas on how to force a clean slate with namespaces?
You can't. That's why the using namespace
clause is so evul. You could include those headers inside another namespace though:
namespace bleh {
#include "library_that_uses_evul_using_namespace.h"
}
That will pollute only the bleh
namespace.