moduleName

Get the module name (including package) for the given symbol.

template moduleName () {
enum bool isNotFunc;
static if(isNotFunc && T.stringof.startsWith("module "))
static if(__traits(compiles, packageName!T))
enum packagePrefix;
static if(isNotFunc && T.stringof.startsWith("module "))
static if(!(__traits(compiles, packageName!T)))
enum packagePrefix;
static if(isNotFunc && T.stringof.startsWith("module "))
enum moduleName;
}

Examples

static assert(moduleName!moduleName == "std.traits");

Meta