I have a simple templated function, defined in a library I am using
template<class T>
T create(std::vector<char>& data)
{
T newValue{};
/* Do something with data */
return newValue;
}
and I want to specialize this function in case T implements a specific interface
template<class T>
std::enable_if_t<std::is_base_of<Interface, T>::value, T> create( std::vector<char>& data)
{
T newValue{};
newValue.InterfaceFunction(data);
return newValue;
}
but I cannot make this work, the function I have specialized is not used. How can I achieve making a specialization of an already defined template function?