86template<Integral Index, Integral Size>
87constexpr inline Index
normalize(Index index, Size bound) {
88 if (index < 0) index += bound;
89 if (index < 0 | index > bound)
120template<Integral Size>
125 if (start < 0 | start > size | stop < 0 | stop > size)
127 return {start, stop};
A simple generic exception type for the Tannic Tensor Library.
Definition: exceptions.hpp:44
Definition: indexing.hpp:37
constexpr Index normalize(Index index, Size bound)
Normalize a possibly-negative index into the valid range [0, bound).
Definition: indexing.hpp:87
Definition: buffer.hpp:41
Represents a half-open interval [start, stop) for slicing.
Definition: indexing.hpp:56
int start
Definition: indexing.hpp:57
int stop
Definition: indexing.hpp:58