C++ Template Metaprogramming Book - Chapter 4

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

On 6/19/06, Eduardo Bezerra
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:
[snipped example]
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.
is_scalar<T> inherits from true_type or false_type, which work for both concepts: integral constant (::value) and nullary-metafunction (::type).
Any help would be greatly appreciated
Regards, Eduardo
PS: Are you from brazil? -- Felipe Magno de Almeida Consultor - Expertise Solutions http://www.expertisesolutions.com.br

Yes Felipe, I am :-)
Obrigado pela ajuda
On 6/19/06, Felipe Magno de Almeida
On 6/19/06, Eduardo Bezerra
wrote: 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:
[snipped example]
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.
is_scalar<T> inherits from true_type or false_type, which work for both concepts: integral constant (::value) and nullary-metafunction (::type).
Any help would be greatly appreciated
Regards, Eduardo
PS: Are you from brazil? -- Felipe Magno de Almeida Consultor - Expertise Solutions http://www.expertisesolutions.com.br _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Eduardo Bezerra
-
Felipe Magno de Almeida