I have this function:
template<typename Type>
typename std::enable_if<!(std::is_arithmetic<Type>::value || std::is_enum<Type>::value), size_t>::type
Serialize(Serializer&, Type&, size_t)
{
static_assert(false, "Serialize<TYPE>() hasn't been specialized for this type.");
return size_t();
}
And this overload:
template<typename ElementType>
size_t Serialize(Serializer &serializer, std::vector<ElementType> &container, size_t pos)
{
//...stuff...
}
I give it a std::vector<std::pair<std::string, int>> (for testing), and it chooses the first function.
Isn't C++ supposed to choose the more-specific function? I mean, this isn't a specialization, it's an overload. Aren't overloads supposed to be chosen over specializations or templates?
As a humorous aside, I had to walk through the debugger to find which templated function was getting called (out of about twenty), because in the main template declaration, I accidentally had static_assert(true, "") instead of static_assert(false, "").