Stratax
0.3.1
Loading...
Searching...
No Matches
Indexing.hpp
1
#pragma once
2
3
#include <cstddef>
4
5
#include <stratax/core/Shape.hpp>
6
7
namespace
stratax::indexing {
8
24
template
<
typename
IndexContainer>
25
std::size_t offset(
26
const
core::Shape& strides,
27
const
IndexContainer& indices)
28
{
29
std::size_t result = 0;
30
31
auto
stride_it = strides.begin();
32
33
for
(
const
auto
index : indices)
34
{
35
result += index * *stride_it;
36
++stride_it;
37
}
38
39
return
result;
40
}
41
42
}
// namespace stratax::indexing
include
stratax
indexing
Indexing.hpp
Generated by
1.9.8