Trying to get the head of a variadic template argument fails

Hi,

I am doing something wrong here:

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;
};


I am getting this error in line 14:

error C3855: 'find_in_tuple': template parameter 'Tables' is incompatible with the declaration

I appreciate any help --- I must be doing something really stupid!

Last edited on
Topic archived. No new replies allowed.