I have problem with implementing recursive template (function in template struct), which will be terminated by std::tuple_size.
Here is fragment of code (I simplified code, to emphasize problem):
template<int index, typename ...T_arguments>
struct Helper
{
static void func (size_t& return_size,
const std::tuple<T_arguments...>& arguments)
{
const auto& argument (std::get<index> (arguments));
return_size += ::value_size (argument);
::Helper<index + 1, T_arguments...>::func (return_size, arguments);
}
// ...
template<typename... T_arguments>
struct Helper<std::tuple_size<T_arguments...>::value, T_arguments...>
{
static void func (size_t& return_size,
const std::tuple<T_arguments...>& arguments)
{
const auto& argument (std::get<std::tuple_size<T_arguments...>::value> (arguments));
return_size += ::value_size (argument);
}
Initial template call looks like this:
Helper<0, T_arguments...>::func (return_size, arguments);
GCC fails with error:
error: template argument ‘std::tuple_size::value’ involves template parameter(s) struct Helper::value, T_arguments...>
std::tuple_size
is claimed to be known at compile time, so why I cannot use it template specialization?