Markus Werle
Hi!
I am trying to migrate some parts of my code from loki to boost::mpl.
Q1: which is the best way to perform nested if-then-else?
Assume given "values": bool B1, bool B2; class ff, class tf, class ft, class tt;
I replaced
----------------------------------------------------------- typedef typename Loki::Select
::Result, typename Loki::Select ::Result >::Result type; ----------------------------------------------------------- with
typedef typename apply_if < bool_c<B1>,
apply_if < bool_c<B2>, identity<tt>, identity<tf>
,
apply_if < bool_c<B2>, identity<ft>, identity<ff>
::type type;
typedef typename
mpl::apply_if_c<
B1
, mpl::if_c
Q2: Is apply_if always to be preferred over if_?
No
apply_if
Q3: (OT) Is there a mpl-equivalent to run-time case?
:-) Aleksey and I have been discussing some shorthands for if (c1) then t1 else if (c2) then t2 else if (c3) then t3 ... else if (c4) then t4 but that's not quite the same as a case statement. -- Dave Abrahams Boost Consulting www.boost-consulting.com