Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-01-03 06:16:13

David Abrahams wrote:
> Second thing: you can save yourself lots of typenames by taking
> advantage of the way MPL lets you pass an uninstantiated metafunction,
> without getting its nested ::type member, wherever a bool_c<...> is
> expected:

Uhm, that's not exactly correct. I would re-formulate it along these lines:

To reduce the notational overhead imposed by the specifics of the
compile-time domain, many of MPL metafunctions, when fully-curried (provided
with all arguments), directly support the interface of the Integral Constant

  BOOST_STATIC_ASSERT(not_equal_to< int_c<5>, int_c<0> >::type::value); //
OK, ordinary function invocation
  BOOST_STATIC_ASSERT(not_equal_to< int_c<5>, int_c<0> >::value); // also

This property often allows you to simplify your compile-time conditions:

> apply_if<
> typename equal_to<N, integral_c<N::value_type, 0> >::type
> , ...
> can be written:
> apply_if<
> equal_to<N, integral_c<N::value_type, 0> >
> , ...


Boost list run by bdawes at, gregod at, cpdaniel at, john at