1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
template<typename T, size_t Pos, size_t Size, typename...Tables>
struct find_in_tuple;
template<typename T, size_t Size, typename Head, typename ...Tail>
struct find_in_tuple<T, Size, Size, Head, Tail...>
{
static constexpr int value = std::is_same<T, Head>::value ? Size - 1 : -1;
};
template<typename T, size_t Pos, size_t Size, typename Head, typename...Tail>
struct find_in_tuple
{
static constexpr int value = std::is_same<T, Head>::value ? Pos : find_in_tuple<T, Pos + 1, Size, Tail...>::value;
};
| |