How to Include a Function in a Namespace Using Namespace Aliases

54 Views Asked by At

The following header is a simplified version of the actual, overly convoluted code. I need to add a function, in an implementation file, to the same namespace as f(). How do I do this, considering that I cannot directly use V?.

Thank you.

// framework header file
namespace N
{
  namespace V {} // not to be used outside header; use the alias below, instead
  namespace VA = V; // using VA outside header is fine
  using namespace V;
  namespace V
  {
    void f();
  }
}

// client impl file
namespace N
{
  namespace V // not allowed
  {
    void g() // this must belong to N::V
    {
      //...
    }
  }
}
0

There are 0 best solutions below