I have a syntax similar to this:
template <class P>
class Foo : public P
{
public:
template <class T> Foo<P> & operator += (const T & v)
{
/*grind*/
return (*this);
}
};
The problem starts when i try to specialize the operator += (outside of class Foo) for a particular type (int for example). I could do this:
template <class P> Foo<P>& Foo<P>::operator += ( const int & v)
{...}
but partial specialization is not possible and it is practically impossible to know the type of P at this point.
Is there any solution for this?
Thanks,
Raxvan.
Instead of putting the logic in the
operator+=, put it in a helper class, this can be partially specialized as required.