
3 Feb
2009
3 Feb
'09
2:23 p.m.
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