Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][mpl, enable_if] checking if a type has specific dependant type
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-12-31 13:46:50


AMDG

Igor R wrote:
> I'd like to define a trait that would evaluate to true for types that
> have some specific dependant type (DependentType), to use like this:
> template<class Type> func(int i, typename
> boost::enable_if<HasDependentType<Type> >::type* dummy = 0)
> {
> }
>
> I tried this way:
>
> template<class Type, class Enable = void> struct HasDependentType :
> mpl::false_ {};
> template<class Type> struct HasDependentType<Type, typename
> Type::DependentType> : mpl::true_ {};
>
> ...but it appears incorrect (partial specialization is never ised).
>

http://www.boost.org/libs/mpl/doc/refmanual/has-xxx-trait-def.html

In Christ,
Steven Watanabe


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