I know that a question very similar has been asked before, "using namespace" in c++ headers, but mine is when its inside of a namespace.
namespace foo {
using namespace std; // what does this do?
class Bar { ... }
}
Does this do exactly the same thing as the other question says and just include that using statement everywhere? Does it only do it in that namespace? Does it only do it in that header?
There are two differences:
using
will only apply to code inside the foo
namespace. But that means all foo
code that sees this header, so you probably still don't want to do it.foo::std
exists, the nested using
statement will favor it over ::std
.