Boost logo

Boost Users :

From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2005-08-26 05:04:18


Alan M. Carroll <amc <at> network-geographics.com> writes:
>
> Is this as simple as it gets?
> Ah, finally, I have an MPL variant that works:
> struct get_key_type { template < typename T > struct apply { typedef
typename T::key_type type; }; };
> typedef typename boost::mpl::eval_if_c<IS_OUTER,
> typename boost::mpl::apply<get_key_type, PAYLOAD>,
> typename boost::mpl::identity<PAYLOAD>
> >::type testing;

You can make it simpler:

template<typename T>
struct get_key_type
{
  typedef typename T::key_type type;
};

typedef typename boost::mpl::eval_if_c<
  IS_OUTER,
  get_key_type<PAYLOAD>,
  boost::mpl::identity<PAYLOAD>
>::type testing;

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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