We have now seen examples of how we can choose between functions using boost::enable_if_c. Let's forget about that technique for this chapter and use a different approach. Consider the following example, where we have a generic method for processing POD datatypes:
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_pod.hpp>
// Generic implementation.
template <class T>
T process(const T& val) {
BOOST_STATIC_ASSERT((boost::is_pod<T>::value));
// ...
}
We also have some processing functions optimized for sizes 1, 4, and 8 bytes. How do we rewrite the process function so that it can dispatch calls to optimized processing functions?