Info
These pollute the namespace they are declared in, for all source files that include these headers (directly or indirectly).
Preliminary list here:
$ find src/mongo -name '*.h' | grep -v stdx/ | grep -v platform/ | xargs git grep -E '^using [^n][^=]*::'
src/mongo/client/fetcher.h:using executor::RemoteCommandRequest;
src/mongo/db/exec/text.h:using std::unique_ptr;
src/mongo/db/exec/text.h:using std::vector;
src/mongo/db/exec/text.h:using fts::FTSQueryImpl;
src/mongo/db/exec/text.h:using fts::FTSSpec;
src/mongo/db/exec/text_match.h:using std::unique_ptr;
src/mongo/db/exec/text_match.h:using fts::FTSMatcher;
src/mongo/db/exec/text_match.h:using fts::FTSQueryImpl;
src/mongo/db/exec/text_match.h:using fts::FTSSpec;
src/mongo/db/exec/text_or.h:using std::unique_ptr;
src/mongo/db/exec/text_or.h:using std::vector;
src/mongo/db/exec/text_or.h:using fts::FTSSpec;
src/mongo/db/field_parser-inl.h:using mongoutils::str::stream;
src/mongo/dbtests/dbtests.h:using std::shared_ptr;
src/mongo/util/concurrency/threadlocal.h:using boost::thread_specific_ptr;
src/mongo/util/log.h:using logger::LogstreamBuilder;
src/mongo/util/log.h:using logger::LabeledLevel;
src/mongo/util/log.h:using logger::Tee;
src/mongo/util/time_support.h:using stdx::chrono::duration_cast;
$ find src/mongo -name '*.h' | grep -v stdx/ | grep -v platform/ | xargs git grep -E '^using namespace'
src/mongo/db/storage/paths.h:using namespace mongoutils;
src/mongo/dbtests/dbtests.h:using namespace mongo;
src/mongo/dbtests/dbtests.h:using namespace mongo::unittest;
src/mongo/util/mongoutils/str.h:using namespace mongoutils;
Top User Comments
billy.donahue commented on Fri, 31 May 2019 16:46:07 +0000:
It's unclear whether a namespace is being "polluted" or merely deliberately composed by these using declarations. Also some namespaces are details and it's ok to bring stuff into them because the impact of doing so is controlled.
The uses of using namespace directives are more controversial, but can still be instances of deliberate composition.
mark.benvenuto commented on Mon, 19 Dec 2016 21:22:49 +0000:
We will also need to add a new check to cpplint.py. There is no similar existing check for banning usings, but a check can be modeled after the regex in the descriptions.