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 12:18:37


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

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

But do the solutions I proposed to Your simplified example compile on Your
compiler? If they do, what's wrong with applying them to your process()
funcions?

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