There are a couple of ways to accomplish this. All involve using the type_traits
header. You can static assert on the types in question in the body of the function, for instance.
Or, if you need to consider this function among other overloads, a SFINAE technique can be employed.
template<typename T>auto isFunction(const T &aVariable) -> std::enable_if_t<std::is_same<T, int>::value || std::is_same<T,anEnum>::value, bool> {}
This will remove the function from an overload set before it's called if the types don't match. But if you don't need this behavior, a static assertion does allow for a more programmer friendly error message.