Could you give a concrete example of using your Match template?
e.g. to perform a different action for floating point or integral
values.
Hey all, I've found myself leaning on a really versatile pattern
a lot lately, thought I'd share it: this is for those situations
where you might have something like
static if (is (typeof(some stuff)))
return some stuff;
else static if (__traits(compiles, more things))
return more things;
or perhaps some other repetitive or confusing piece of
metaprogramming logic whose goal is to decide what code to
execute.
instead, try:
auto option_a ()() {return some stuff;}
auto option_b ()() {return more things;}
return Match!(option_a, option_b);