c++ - Using Namespace visibility in header -


i working on c++ library split multiple namespaces. since trying avoid "using" directive in header files forced alternative "namespace::class" variables, returns , parameters. can imagine messy. so, tried putting using statement inside namespace decloration (see below) , seemed trick, doesn't appear visible in files including file.

namespace project {     namespace utility { class a; }  namespace system {     using utility::a;      class b     {         *a;   // instead of utility::a *a     }; } } 

my question is, okay instead?

// header  namespace project {     namespace utility { class a; }  namespace system {     using utility::a;      class b     {         *a;   // instead of utility::a *a     }; } }  // end header  class {};  int main() {     using namespace project::system;     a; }  test.cpp:25:5: error: reference 'a' ambiguous     a;     ^ test.cpp:20:7: note: candidate found name lookup 'a' class {};       ^ test.cpp:9:20: note: candidate found name lookup 'project::system::a'     using utility::a;                    ^ 1 error generated. 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -