One of the many examples of two macros being used to open and close a namespace
respectively is in /usr/include/boost/hana/transform.hpp
:
BOOST_HANA_NAMESPACE_BEGIN
// stuff
BOOST_HANA_NAMESPACE_END
Those macros are defined like this in /usr/include/boost/hana/config.hpp
:
#define BOOST_HANA_NAMESPACE_BEGIN namespace boost { namespace hana {
#define BOOST_HANA_NAMESPACE_END }}
What is the advantage of doing so?
(Considering that there's at least one disvantage: that it makes it harder to jump back and forth from beginning to end of namespace
s.)
This was originally for forward compatibility with using inline namespaces, however this never became relevant. I re-opened https://github.com/boostorg/hana/issues/288 and will change it to normal namespace declarations.