#include <iostream>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
namespace a { namespace b {
namespace x {
int test1 = 1;
}
namespace y {
int test2 = 2;
}
namespace z {
int test3 = 3;
}
}
}
#define USE_NAMESPACES_IMPL( r, root, name ) \
using namespace root :: name;
#define USE_NAMESPACES( root, names ) \
BOOST_PP_SEQ_FOR_EACH( USE_NAMESPACES_IMPL, root, names )
USE_NAMESPACES( a::b, (x)(y)(z) )
int main() {
std::cout << test1 << '\n';
std::cout << test2 << '\n';
std::cout << test3 << '\n';
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKI2luY2x1ZGUgPGJvb3N0L3ByZXByb2Nlc3Nvci9jYXQuaHBwPgojaW5jbHVkZSA8Ym9vc3QvcHJlcHJvY2Vzc29yL3NlcS9mb3JfZWFjaC5ocHA+CgpuYW1lc3BhY2UgYSB7IG5hbWVzcGFjZSBiIHsKICAgIG5hbWVzcGFjZSB4IHsKICAgICAgaW50IHRlc3QxID0gMTsKICAgIH0KICAgIG5hbWVzcGFjZSB5IHsKICAgICAgaW50IHRlc3QyID0gMjsKICAgIH0KICAgIG5hbWVzcGFjZSB6IHsKICAgICAgaW50IHRlc3QzID0gMzsKICAgIH0KICB9Cn0KCiNkZWZpbmUgVVNFX05BTUVTUEFDRVNfSU1QTCggciwgcm9vdCwgbmFtZSApIFwKICB1c2luZyBuYW1lc3BhY2Ugcm9vdCA6OiBuYW1lOwoKI2RlZmluZSBVU0VfTkFNRVNQQUNFUyggcm9vdCwgbmFtZXMgKSBcCiAgQk9PU1RfUFBfU0VRX0ZPUl9FQUNIKCBVU0VfTkFNRVNQQUNFU19JTVBMLCByb290LCBuYW1lcyApCgpVU0VfTkFNRVNQQUNFUyggYTo6YiwgKHgpKHkpKHopICkKCmludCBtYWluKCkgewoKICBzdGQ6OmNvdXQgPDwgdGVzdDEgPDwgJ1xuJzsKICBzdGQ6OmNvdXQgPDwgdGVzdDIgPDwgJ1xuJzsKICBzdGQ6OmNvdXQgPDwgdGVzdDMgPDwgJ1xuJzsKICAKICByZXR1cm4gMDsKfQo=