Skip to content

strata::StridedMapping

Part of Order and layout.

template <shape_like S, Extent... Strides>
class strata::StridedMapping;

The index to offset map for arbitrary strides, one per axis.

The static strides are part of the type (Strided<Dyn, 1>: the outer stride at run time, the inner one 1). Elements need not be contiguous: slices along a fast axis, blocks and regular steps through a buffer all land here.

Template parameters

Name Description
S The shape.
Strides One per axis: a number for a static stride, Dyn for a dynamic one.

Members

StridedMapping

constexpr StridedMapping() noexcept=default

The mapping of the default shape, with its dynamic strides 0.

constexpr StridedMapping(const S &shape, const std::array<std::size_t, core::rank()> &strides) noexcept

The mapping of shape with the given strides.

Parameters

Name Description
shape The shape.
strides Every stride, static ones included; those must match the type.
template <typename Other>
constexpr StridedMapping(const Other &other) noexcept

Converts from any mapping, dense or strided, whose shape converts to S and whose static strides cover the ones fixed here.

Dense converts to strided, and Strided<Dyn, 1> to Strided<Dyn, Dyn>.

required_span_size

constexpr std::size_t required_span_size() const noexcept

The number of elements from the first mapped one to the last, inclusive; 0 when empty.

operator==

constexpr bool operator==(const StridedMapping &lhs, const StridedMapping &rhs) noexcept

Equal when the shapes and the strides are.