hi all
if(T is Libor)
return LiborType
if(
or(
or(T = Euribor,
T = EURLibor),
is_base_of(T, Libor)
),
ConstrType2,
if(
or(is_base_of(T, Euribor),
is_base_of(T, EURLibor)),
ConstrType1,
ConstrType
)
)
When I first coded it and instantiate T with some derived class of Libor, the final type is always a generic type. Few more testing shows that the inner if_ in the code below
typedef typename
boost::mpl::if_
<
boost::is_same<InType, QuantLib::Libor>,
QuantLib::Libor,
boost::mpl::if_
<
boost::mpl::or_
<
boost::is_same<InType, QuantLib::Euribor>,
boost::is_same<InType, QuantLib::EURLibor>,
boost::is_base_of<QuantLib::Libor, InType>
>
ConstrType2,
boost::mpl::if_
<
boost::mpl::or_
<
boost::is_base_of<QuantLib::Euribor, InType>,
boost::is_base_of<QuantLib::EURLibor, InType>
>,
ConstrType1,
ConstrType
>
>
>::type Type;
does not reduce to ConstrType1/ConstrType2/ConstrType but the whole is used as a type. So the final Type is just a type with 3 nested if_ class inside. I tried linearising the logic but this introduces other problem. Is this a bug or a limitation of mpl::if_?
Thanks