FUNCTION_NAME

mixin template FUNCTION_NAME () {
enum __FUNCTION_NAME__;
}

Return Value

function name of the current function

Examples

enum name_another = "another";
import std.algorithm.searching : countUntil;

struct Something {
    mixin("int " ~ name_another ~ ";");
    void check() {
        // Check that basename removes (this.) from the scope name space
        static assert(this.another.stringof.countUntil('.') == this_dot.countUntil('.'));
        static assert(basename!(this.another) == name_another);
    }
}

Something something;
// check that basename work in global scope (not this.)
static assert(something.stringof.countUntil('.') == -1);
static assert(basename!(something.another) == name_another);