Ok, i'll try to keep this short. I know you can generate an integer sequence for variadic templates with std::index_sequence_for
. Now suppose i want that index sequence to start at a specific offset, but still be the same length as the variadic template argument list. Is that possible? I didn't find anything of the sort on cppreference.
You may write your own easily:
template <std::size_t Offset, std::size_t ... Is>
std::index_sequence<(Offset + Is)...> add_offset(std::index_sequence<Is...>)
{
return {};
}
template <std::size_t Offset, std::size_t N>
auto make_index_sequence_with_offset()
{
return add_offset<Offset>(std::make_index_sequence<N>{});
}
Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With