Array和Tuple转换

//#include 

template 
decltype(auto) array2tuple_impl(const Array &a, std::index_sequence)
{
    return std::make_tuple(a[N]...);
}

template 
decltype(auto) array2tuple(const std::array &a)
{
    return array2tuple_impl(a, std::make_index_sequence{});
}

template 
decltype(auto) tuple2array_impl(std::tuple &t, std::index_sequence)
{
    return std::array{{std::get(t)...}};
}

template 
decltype(auto) tuple2array(std::tuple t)
{
    return tuple2array_impl(t, std::make_index_sequence{});
}

你可能感兴趣的:(Array和Tuple转换)