Reputation: 2399
Let's say I have a namespace:
namespace UI
{
}
And I have another namespace:
namespace Domain
{
}
Now let's say in the Domain namespace I also have a UI namespace that is specific for that domain.
namespace Domain
{
namespace UI
{
}
}
Is it possible to import the global UI namespace into the domain UI namespace without importing it in the Domain namespace? I know using namespace is often not a good idea but conceptually the domain UI namespace should be both in the global UI namespace and in the domain namespace.
Upvotes: 1
Views: 81
Reputation: 165
The only possible ways are namespace alias or use the entire namespace UI into Domain::UI. In both cases theres a way for access it from Domain namespace.
Examples:
namespace UI {
class Test {
};
}
namespace Domain {
}
namespace Domain {
namespace UI {
namespace _UI = ::UI;
struct Test2 {
_UI::Test param;
};
}
}
namespace Domain2 {
namespace UI {
using namespace ::UI;
struct Test2 {
Test param;
};
}
}
Upvotes: 2