With using namespace I make the whole contents of that namespace directly visible without using the namespace qualifier. This can cause problems if using
The closest, that I'll try to use in header files is following:
//example.h
#ifndef EXAMPLE_H_
#define EXAMPLE_H_
/**
* hating c++ for not having "undo" of using namespace xx
*/
#define string std::string
#define map std::map
class Example {
public:
Example (const char *filename);
Example (string filename);
~Example ();
private:
map my_complicated_map;
};
#undef string
#undef map
#endif //EXAMPLE_H_
after all, defines are #undef -able. There are 2 problems: 1. it is ugly 2. separate #define and #undef for each name from the corresponding namespace are used