Template memberFunctionsOf

Returns a list of member functions of T

template memberFunctionsOf(T) ;

You can retireve them as a tuple of aliases, or strings

Contained Aliases

asAliases Get as a tuple of aliases
asStrings Get as tuple of strings


import std.meta: AliasSeq;
struct A {
    void opCall() {}
    void g() {}

struct B {
    int m;
    A a;
    alias a this;
    void f0() {}
    void f1() {}

immutable array = [memberFunctionsOf!B.asStrings];
alias strings = memberFunctionsOf!B.asStrings;
alias aliases = memberFunctionsOf!B.asAliases;

static assert(array == ["f0", "f1"]);
static assert(strings == AliasSeq!("f0", "f1"));

static assert(is(typeof(array) == immutable string[]));
static assert(is(typeof(strings) == AliasSeq!(string, string)));
static assert(is(typeof(aliases) == AliasSeq!(typeof(B.f0), typeof(B.f1))));