You can use something like:
template <typename T, typename... Ts> struct get_index;
template <typename T, typename... Ts>
struct get_index<T, T, Ts...> : std::integral_constant<std::size_t, 0> {};
template <typename T, typename Tail, typename... Ts>
struct get_index<T, Tail, Ts...> :
std::integral_constant<std::size_t, 1 + get_index<T, Ts...>::value> {};
#if 1
template <typename T>
struct get_index<T>
{
static_assert(sizeof(T) == 0, "element not found");
};
#endif
Living example
Note. You do not indicate what happens for the type of duplicate match (so I take the first one), or if the type is not mapped (so I made a compile-time error)
Live Demo