```
template<typename T>
struct A
{
A<T> operator%( const T& x);
};
template<typename T>
A<T> A<T>::operator%( const T& x ) { ... }
```

How can I use enable_if to make the following specialization happen for any floating point type (is_floating_point)?

```
template<>
A<float> A<float>::operator%( const float& x ) { ... }
```

EDIT: Here's an answer I came up which is different from the ones posted below...

```
template<typename T>
struct A
{
T x;
A( const T& _x ) : x(_x) {}
template<typename Q>
typename std::enable_if<std::is_same<Q, T>::value && std::is_floating_point<Q>::value, A<T> >::type operator% ( const Q& right ) const
{
return A<T>(fmod(x, right));
}
template<typename Q>
typename std::enable_if<std::is_convertible<Q, T>::value && !std::is_floating_point<Q>::value, A<T> >::type operator% ( const Q& right ) const
{
return A<T>(x%right);
}
};
```

Like the below posters say, using enable_if may not be ideal for this problem (it's very difficult to read)