Reputation: 68708
What is the difference between:
namespace A
{
inline namespace B
{
...
}
...
}
...
and
namespace A
{
namespace B
{
...
}
using namespace B;
...
}
...
That is, what is the difference between an inline namespace, and a non-inline namespace with a using directive placed in its enclosing namespace?
Upvotes: 6
Views: 949
Reputation: 68708
Paraphrased from C++11 7.3.1p8:
The inline namespace and its enclosing namespace are both added to the set of associated namespaces used in argument-dependent lookup whenever one of them is.
Each member of the inline namespace can subsequently be explicitly instantiated or explicitly specialized as though it were a member of the enclosing namespace.
Looking up a name in the enclosing namespace via explicit qualification will include members of the inline namespace brought in by the using-directive even if there are declarations of that name in the enclosing namespace.
Upvotes: 2