是否有私人使用名称=类型;

Is there a private using name = type;

我要写:

namespace A{
    using name = type;
}

但如果我尝试从另一个 space 使用它,它将可用。我可以在其名称中将其设为私有吗space?

没有语言功能允许这样做,但许多项目都有约定,命名空间 detail 的所有内容都是保留的,不应使用。

namespace A {
    namespace detail {
        using name = type;
    }

    //something using detail::name
}

//A::detail::name technically accessible, but disallowed by convention

不,你不能:命名空间是(粗略地说)public,除非整个事物都在 匿名命名空间 中,在这种情况下,它只对那个人可见编译单元。

namespace{
    namespace A{
        using name = type;
    }
}