|
Boost Users : |
Subject: Re: [Boost-users] Nullary metafunction
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2009-02-03 16:23:05
Steven Watanabe <watanabesj <at> gmail.com> writes:
> AMDG
> Joaquin M Lopez Munoz wrote:
> > er <erwann.rogard <at> gmail.com> writes:
> >
> >> Hi All,
> >>
> >> I'm looking for template<typename> class F such that
> >>
> >> F<T>::type is T::type if it exists, T itself otherwise.
> >> [...]
> > Something like this could do:
> [...]
> Wouldn't it be easier to use the MPL components
> that already exist?
>
> BOOST_MPL_HAS_XXX_TRAIT_DEF(type);
>
> template<class T>
> struct nested_type :
> boost::mpl::eval_if<has_type<T>,
> T,
> boost::mpl::identity<T> >
> {};
Oh, yes, that's definitely the way to go, didn't
remember about BOOST_MPL_HAS_XXX_TRAIT_DEF. Sorry for
the noise.
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