Renaming a namespace
Using BRONTO_INLINE() to rename a namespace.
You can use BRONTO_INLINE() to rename a namespace across your entire code
base.
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. Simply add BRONTO_INLINE() to the beginning of the
using directive.
Everywhere you have namespace old_namespace { ... }, surrounding symbols you want moved to
new_namespace, transform the code to
namespace new_namespace {
...
}
namespace old_namespace {
BRONTO_INLINE() using namespace new_namespace;
}Note that if you don't want every symbol to be moved, you can leave some of them
in old_namespace. Only the ones placed in namespace new_namespace { ... }
will be renamed.
Adding the line BRONTO_INLINE() using namespace new_namespace; ensures that
the symbols you have moved to new_namespace are still available through
old_namespace. This ensures that your code still compiles, but alerts Bronto
that your intent is to migrate to new_namespace.
Sit back while Bronto finds all the symbols in old_namespace and changes
them to new_namespace.
After Bronto has finished, remove the using directives, so users don't add new usage that rely on
them.
See it in action on Compiler Explorer.