Remove `using namespace std;`
Using BRONTO_INLINE()
to remove using namespace std
Many large C++ codebase added using namespace std
as a cheap shortcut
years ago. As the code base grew, it started causing low-grade pain, like naming conflicts and surprising function-call resolutions. Unfortunately, it's just too pervasive to fix manually. Let Charlotte Bronto help.
The BRONTO_INLINE()
attribute can be attached to any using
directive to indicate that symbols
found via that directive should be qualified with the corresponding namespace.
Add BRONTO_INLINE()
to the using
directive.
using namespace std BRONTO_INLINE();
If this shows up in many files, grep
and sed
should be able to add the attribute, as the lines
are sufficiently unique.
Sit back while Bronto finds all the symbols in namespace std
that need to have std::
added to
them.
After Bronto has finished, remove the using
directive, so users don't add new usage that relies on
it.
See it in action on Compiler Explorer.