hasOnValueSet

Template to determine if hook provides function called when value is set.

@safe
template hasOnValueSet (
Hook
T
) {
enum hasOnValueSet;
enum hasOnValueSet;
}

Examples

1 struct Hook {
2     static int lastValue;
3     static void onValueSet(T)(auto ref T val) { lastValue = val; }
4 }
5 
6 static assert(hasOnValueSet!(Hook, int));
7 auto res = ok!(string, Hook)(42);
8 assert(res.hasValue);
9 assert(Hook.lastValue == 42);

Meta