Models

Mixin that ensures a type models the desired signature of a structure

mixin template Models (
alias Sig
string file = __FILE__
int line = __LINE__
) {}

Examples

struct Sig {
    alias I = int;
    int x;
    float y;
    struct Inner { int a; struct X { int b; } }
    int f(int) { return 0; }
    enum X { one, two }
    union L { int a; }
}

struct Y {
    mixin Models!Sig;
    alias I = int;
    int x;
    float y;
    struct Inner { int a; struct X { int b; } }
    int f(int) { return 0; }
    enum X { one, two }
    union L { int a; }
}

static assert(isModelOf!(Y, Sig));

Meta