I am working on a c++ library which is split up into multiple namespaces. Since I am trying to avoid the “using” directive in header files I am forced to do the alternative “namespace::class” for variables, returns and parameters. As you can imagine this could get messy. So, I tried putting the using statement inside a namespace decloration (see below) and that seemed to do the trick, It doesn’t appear to be visible in files including this file.
namespace Project
{
namespace Utility { class A; }
namespace System
{
using Utility::A;
class B
{
A *a; // instead of Utility::A *a
};
}
}
My question is, would it be okay to do this instead?
1 Answer