UnderscoreOpDispatcher

Mixin template generating an opDispatch redirecting calls to members whose names match the passed variable string but with an underscore prepended to the name.

This is a convenience mixin for OpDispatcher!("_", Yes.inFront).

Mixed In Members

From mixin OpDispatcher!("_", Yes.inFront)

opDispatch
auto ref opDispatch(T value)

Mutator.

opDispatch
auto ref opDispatch()

Accessor.

Examples

struct Bar
{
    string _s;
    int _i;
    bool _b;
    string[string] _aa;

    mixin UnderscoreOpDispatcher;
}
static struct Bar
{
    string _s;
    int _i;
    bool _b = true;
    string[string] _aa;
    mixin UnderscoreOpDispatcher;
}

Bar bar;
bar.s = "hi there";
bar.i = -123;
bar.b = false;
bar.aa = [ "hello" : "world" ];
bar.aa = [ "foo" : "bar" ];
assert(bar.aa == [ "hello" : "world", "foo" : "bar"]);

See Also