Type deduction of parameters in function templates requires the type to appear in a non-dependent context.
typename X::type however is a dependent type. This rule exists because otherwise, the compiler would have to perform an exhaustive search (it cannot know which template arguments lead to the result type).
That is why SFINAE is always implemented through an additional default function parameter, an additional template parameter or the return type -- but
not one of the regular function parameters.
In this case, only option 2 and 3 work; for example, you can use the return type.
template <typename Enum>
typename std::enable_if<std::is_enum<Enum>::value, sf::Packet&>::type
operator<< (sf::Packet& packet, Enum t)
{
...
}
template <typename Enum>
typename std::enable_if<std::is_enum<Enum>::value, sf::Packet&>::type
operator>> (sf::Packet& packet, Enum& t)
{
...
}
By the way: Next time, please post the compiler message and the used compiler, and fix your code before posting (missing semicolon, wrong
EnumT). It's a pity when it's not clear whether the problem arises from a simple typo or something more complex. Just copy-paste the code, do not type it here by hand.