AMDG
Tobias Schwinger
Now that that's cleared, let me /push/ now the other benefits of my proposed interface:
* Ability to allow fall-through and break:
case_<1>(f1, break_), // no fall-through case_<2>(f2), // fall-through (by default)
* Allow multiple case handling:
case_<'x', 'y'>(f2), // handle 'x' and 'y'
This stuff is pretty cool. But it -again- makes me think we are in fact talking about two different kinds of switch tools: One that can be used manually with lots of syntactic sugar - and another one that's mean and lean and doesn't have to be that pretty because it's intended to be fed its input in form of an automatically computed sequence, anyway...
I'm inclined to agree. Regarding multiple case handling, there have to be two layers. The outer layer exposed to the user has to separate everything into separate cases, possibly using a no-op function that falls through. Expanding the sequence seems a bit too heavy weight for me. I would at least want to have the internal dispatching function exposed directly so that those who don't need this kind of fanciness don't have to pay for it. In Christ, Steven Watanabe