Boost logo

Boost Users :

Subject: Re: [Boost-users] [mpl, enable_if] "Failed to specialize function template"
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2010-12-14 11:41:10


2010/12/14 Igor R <boost.lists_at_[hidden]>

> > I thing sfinae should disable the above test() functions for every Type,
> > that doesn't have a nested type my_type.
>
> So is it possible not to evaluate Type::my_type, if Type is int? I
> tried to use lazy_enable_if, but with no success...
>
>
How about adding this overload:

void test( int )
{
}

Or if You want to disable implicit conversions to int, add this overload
instead:
template<typename Type>
void test(Type, typename boost::enable_if< boost::is_same<Type, int>
>::type* dummy = 0)
{
}

warning: untested

Regards,
Kris



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