Front Page / Metafunctions / Type Selection / eval_if |
template< typename C , typename F1 , typename F2 > struct eval_if { typedef unspecified type; };
Evaluates one of its two nullary-metafunction arguments, F1 or F2, depending on the value C.
#include <boost/mpl/eval_if.hpp>
Parameter | Requirement | Description |
---|---|---|
C | Integral Constant | An evaluation condition. |
F1, F2 | Nullary Metafunction | Metafunctions to select for evaluation from. |
For any Integral Constant c and nullary Metafunctions f1, f2:
typedef eval_if<c,f1,f2>::type t;
Return type: | Any type. |
---|---|
Semantics: | If c::value == true, t is identical to f1::type; otherwise t is identical to f2::type. |
typedef eval_if< true_, identity<char>, identity<long> >::type t1; typedef eval_if< false_, identity<char>, identity<long> >::type t2; BOOST_MPL_ASSERT(( is_same<t1,char> )); BOOST_MPL_ASSERT(( is_same<t2,long> ));