Skip to content

strata::SemiStaticValues

Part of Utilities.

template <std::size_t... Values>
class strata::SemiStaticValues;

Values of which the type fixes some and stores the others, in order.

SemiStaticValues<3, dyn_marker, 5> holds one size_t. What a Shape's extents and a mapping's strides are both made of; std::extents without its interface.

Template parameters

Name Description
Values One per position: the value the type fixes there, or the maximum of std::size_t (dyn_marker) where the value is stored.

Members

size

static constexpr std::size_t size = sizeof...(Values)

The number of values, fixed and stored.

dyn_count

static constexpr std::size_t dyn_count = static_cast<std::size_t>(std::ranges::count(spec_, detail::dyn_marker))

The number of stored values.

static_value_at

static constexpr std::optional<std::size_t> static_value_at(std::size_t idx) noexcept

The value the type fixes at idx, if any.

Precondition

idx < size.

operator[]

constexpr std::size_t operator[](std::size_t idx) const noexcept

The value at idx, fixed or stored.

Precondition

idx < size.

dyn_values

constexpr std::span<const std::size_t, dyn_count> dyn_values() const noexcept

The stored values, in order; empty when every value is static.

set

constexpr void set(std::size_t idx, std::size_t value) noexcept

Sets the value at idx: stored where it is not static, checked against the type where it is.

Precondition

idx < size, and where the value is static, value equals it.

set_dyn

constexpr void set_dyn(std::size_t slot, std::size_t value) noexcept

Sets the slot-th stored value directly: for values given without the static ones between.

Precondition

slot < dyn_count.