We continue working with Boost metaprogramming libraries. In the previous recipe, we saw how to use enable_if_c with classes; now it is time to take a look at its usage in template functions.
Imagine that, in your project, you have a template function that works with all the available types:
template <class T>
T process_data(const T& v1, const T& v2, const T& v3);
That function exist for a long time. You have written a lot of code that uses it. Suddenly, you came up with an optimized version of the process_data function but only for types that do have an T::operator+=(const T&):
template <class T>
T process_data_plus_assign(const T& v1, const T& v2, const T& v3);
You've got a huge code base and it may take months to manually change process_data to the process_data_plus_assign for types...