C++ 如何使用名称空间别名在名称空间中包含函数

C++ 如何使用名称空间别名在名称空间中包含函数,c++,namespaces,namespace-alias,C++,Namespaces,Namespace Alias,下面的标题是实际的、过于复杂的代码的简化版本。我需要在实现文件中添加一个函数到与f()相同的命名空间中。考虑到我不能直接使用V,我该怎么做 多谢各位 // 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

下面的标题是实际的、过于复杂的代码的简化版本。我需要在实现文件中添加一个函数到与
f()
相同的命名空间中。考虑到我不能直接使用
V
,我该怎么做

多谢各位

// 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
    {
      //...
    }
  }
}

我认为这是不可能的。但这只是一种预感。@einpoklum我也有同样的想法,但我仍然希望。那就投票支持信仰吧:-)我认为这是不可能的。但这只是一种预感。@einpoklum我也有同样的想法,但我仍然希望如此。那就投票支持信仰吧:-)