From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-06-04 17:22:32


AMDG

Larry Evans wrote:
> Steven, there was also something on the c.l.c++.m newsgroup about this.
> There's even a comparison with switch_ here:
>
> http://groups.google.com/group/comp.lang.c++.moderated/msg/771d715f3f238fee
>

Ok. I think that the easiest way to state the difference is that Switch
is a lower level generic
component, while the solution proposed there is specific to accessing
tuples. Both the performance
considerations mentioned in that post can be implemented on top of
switch. Optimizing away the
default can be handled by passing a function object like

template<class R>
struct never_called {
    template<class N>
    R operator()(N) { __assume(0); }
};

In Christ,
Steven Watanabe