Skip to content

Instantly share code, notes, and snippets.

@JohanMabille
Created January 1, 2020 20:36
Show Gist options
  • Save JohanMabille/588c301c57f12df3ccb4ee185ea7b959 to your computer and use it in GitHub Desktop.
Save JohanMabille/588c301c57f12df3ccb4ee185ea7b959 to your computer and use it in GitHub Desktop.
template <size_t dim = 0, class S>
auto raw_data_offset(const S&) noexcept
{
return typename S::value_type(0);
}
template <size_t dim = 0, class S, class I, class... Args>
auto raw_data_offset(const S& strides, I i, Args... args) noexcept
{
return i * strides[dim] + raw_data_offset<dim + 1>(strides,
args...);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment