I have the following code I’m refactoring:
namespace Foo
{
namespace Bar { ...classes... }
}
Bar is now moving into a new top-level namespace, but I’ld like to keep API compatibility:
namespace Pi { ...classes... } // refactored Foo::Bar
namespace Foo { namespace Bar = Pi; } // API compatibility
This doesn’t work, since it aliases Foo::Bar::Class to Foo::Pi::Class, but not Pi::Class. Is there a way (short of a macro or typedef’ing all Pi classed) to achieve what I want?
If I understand correctly, this should do what you need. It means that any lookup in
Foo::Barwill find names in::Pi.Obviously, this won’t preserve binary compatibility.