简体   繁体   English

向名称空间别名添加定义

[英]adding definitions to namespace alias

Is it possible to add something to a namespace alias? 是否可以在命名空间别名中添加内容? Or how can I achieve the following: 或者我如何实现以下目标:

using KdTree = ExternalLibrary::Special::KdTree;

namespace KdTree{
    class MySpezial {};
};

That does not work, but the following works: 这不起作用,但以下工作:

using KdTree = ExternalLibrary::Special::KdTree;

namespace ExternalLibrary{ namespace Special { namespace KdTree{
    class MySpezial {};
}}};

Is the first method just prohibited by the standart? 标准是否禁止使用第一种方法?

The first example is currently not allowed and probably won't be in C++1Z either, but note that a recent proposal is allowing 第一个例子目前是不允许的,也可能不会在C ++ 1Z中,但请注意最近的提案是允许的

namespace ExternalLibrary::Special::KdTree {
    class MySpezial {};
}

This is already implemented in Clang . 这已在Clang中实现

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM