namespace nm
{
class C1 {};
class C2 {};
inline std::ostream& operator << (std::ostream& lhs, std::vector<C1> const&) { return lhs; }
inline std::ostream& operator << (std::ostream& lhs, std::vector<C2> const&) { return lhs; }
}
using nm::operator<<;
Is there way to declare to use only one of operators <<
from namespace nm
in the global one, and not both?
One solution would be to put each operator<<
in its own nested name space:
namespace nm
{
class C1 {};
class C2 {};
namespace nm1 {
inline std::ostream& operator << (std::ostream& lhs, C1 const&) { return lhs; }
}
namespace nm2 {
inline std::ostream& operator << (std::ostream& lhs, C2 const&) { return lhs; }
}
}
using nm::nm1::operator<<;
LIVE DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With