What about the idea of matching filenames to namespaces, with each file pair having one namespace. Then it would not matter if the header file contains using statements, because no matter which file is included in which other files, no using expressions would conflict.
Here is an example where one part of a project is using the version of the standard library provided with the compiler, and another part is using the SGI version of the standard library:
// ide_cpp_preprocessor.h#include <string>#include <istream>#include <ostream>namespace ide { namespace cpp { namespace preprocessor { using std::string; using std::istream; using std::ostream; namespace symbol { bool check (const string& name); void replace(const string& name, const ostream& out); } } }}// ide_cpp_parser.cpp#include "ide_cpp_preprocessor.h"#include <sgi/string>#include <sgi/istream>#include <sgi/ostream>namespace ide { namespace cpp { namespace parser { using sgi::string; using sgi::istream; using sgi::ostream; namespace read { name(istream& in, ostream& out) { /* ... */ } // no conflict } } }}
Edited by - null_pointer on December 18, 2001 2:27:52 PM