template
struct A
{
A operator%( const T& x);
};
template
A A::operator%( const T& x ) {
You can also use a default boolean template parameter like this:
template
struct A
{
T x;
A( const T& _x ) : x(_x) {}
template
typename std::enable_if::value && EnableBool, A >::type
operator% ( const T& right ) const
{
return A(fmod(x, right));
}
template
typename std::enable_if::value && EnableBool, A >::type
operator% ( const T& right ) const
{
return A(x%right);
}
};