August 2017
Intermediate to advanced
438 pages
14h 19m
English
The Boost.MPL metafunctions are actually structures that can be easily passed as a template parameter. The hard part is to use it correctly:
#include <boost/mpl/apply.hpp>#include <boost/mpl/if.hpp>#include <boost/type_traits/is_same.hpp>
template <class Param1, class Param2, class Func1, class Func2>struct coalesce { typedef typename boost::mpl::apply<Func1, Param1>::type type1; typedef typename boost::mpl::apply<Func2, Param2>::type type2;
typedef typename boost::mpl::if_< boost::is_same< boost::mpl::false_, type1>, type2, type1 >::type type;};
That's it! We ...
Read now
Unlock full access