|
Boost Users : |
Subject: Re: [Boost-users] Please help with enable_if problem
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-04-13 21:06:13
AMDG
John Dlugosz wrote:
> I'm getting tons of this from Microsoft's compiler:
>
> error C2893: Failed to specialize function template 'enable_if<boo...
>
Without the actual error message, I'm not sure I can help much.
> but isn't that the whole point of using enable_if? I'm using it already in my project and understand the idea behind it.
>
> Here is the function in question:
>
> template <typename T, typename D>
> typename enable_if<
> boost::mpl::and_<
> std::tr1::is_base_of<generic_linear_time_ntbase, T>,
> boost::mpl::or_<
> is_dimensional_time<D>,
> std::tr1::is_same<duration,D>,
> std::tr1::is_same<linear_duration,D>
> >
> >,
> T>::type&
> operator+= (T& left, const D& right)
> {
> left.addop_ (right); // real implementation is in the generic base class
> return *this; // but I need this template to return the correct derived (actual) class.
> }
>
This can't be the real code, because it wouldn't compile
as a member because it takes two arguments, and wouldn't
compile as a non-member, because it uses "this."
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