Boost logo

Boost Users :

From: Eduardo Bezerra (edubez_at_[hidden])
Date: 2006-06-19 14:04:54


Hi,

In C++ Template Metaprogramming chapter 4, item 4.1.2. Lazy Type Selection
typename is_scalar<T>::type and is_scalar<T> can be used interchangeably
as in the example below:

template <class T>
   struct param_type
     : mpl::eval_if<
           typename boost::is_scalar<T>::type
         , mpl::identity<T>
         , boost::add_reference<T const>
> // no ::type here
{};

template <class T>
   struct param_type
     : mpl::eval_if<
           boost::is_scalar<T>
         , mpl::identity<T>
         , boost::add_reference<T const>
>
{};

I'm still trying to figure out the reason why.

I understand that to invoke a metafunction you have to reach into its
nested ::type member and I also know that integral constant wrappers
have a ::value member.

Any help would be greatly appreciated

Regards,
Eduardo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net