Quantcast
Channel: User HolyBlackCat - Stack Overflow
Viewing all articles
Browse latest Browse all 1315

Answer by HolyBlackCat for why does 'using namespace' not take priority when in a namespace

$
0
0

As explained on cppreference, using namespace doesn't bring the names into the current scope. It brings them to the most nested common enclosing namespace of the current namespace and the one you're importing.

In this case that common namespace is ::, so it behaves as if you declared your operators in the global namespace. They are understandably shadowed by ns::operator<< when inside of namespace ns.


Viewing all articles
Browse latest Browse all 1315