Boost logo

Boost Users :

Subject: Re: [Boost-users] [mpl, enable_if] "Failed to specialize function template"
From: Igor R (boost.lists_at_[hidden])
Date: 2010-12-14 12:05:07


> 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)
> {
> }

Well, it was just minimal reproducing sample...
In my real code I look-up some type in an mpl::map, then I have to
call a function, IF the type was found (i.e. it's not mpl::void_) AND
its inner type passes meta-function filter. So the code looks like
this:

typedef at<my_map, my_type>::type found_type;
process(found_type());

template<typename Type>
void process(Type,
  typename boost::enable_if
  <
    and_
    <
      not_<is_same<Type, void_> >,
      typename apply<filter, typename Type::inner_type>::type
>
>::type* dummy = 0)
{
  ....
}


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