简体   繁体   中英

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

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

This is already implemented in Clang .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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