Utilities¶
Concepts, precondition checks and the building blocks shared across strata.
Concepts¶
| Name | Description |
|---|---|
axis_permutation | Whether Axes is a permutation of 0 ... rank - 1: every axis once, none out of range. |
index_like | An integer usable as an extent or an index; bool is excluded on purpose. |
Types¶
| Name | Description |
|---|---|
fixed_string | A string literal as a template argument: einsum<"ij,jk->ik">. |
SemiStaticValues | Values of which the type fixes some and stores the others, in order. |
Functions¶
expects¶
template <typename... Args>
constexpr void expects(bool condition, detail::checked_format<std::type_identity_t<Args>...> message, const Args &... args) noexcept
Checks a precondition: expects(axis < rank, "axis {} out of range for rank {}", axis, rank).
Always checked during constant evaluation, where it is free, and there a violation is a compile error; at run time only without NDEBUG, and there it prints the message and the call site, then aborts. The message is formatted only on failure, and its format string is checked against the arguments at compile time, like that of std::format.
Placed first in a function body, it becomes a pre(...) on the declaration once C++26 contracts work in both compilers with modules.
Parameters
| Name | Description |
|---|---|
condition | What must hold. |
message | A format string for the message. |
args | The arguments of the format string. |
Variables¶
runtime_checks¶
Whether expects checks at run time: true unless NDEBUG is defined.
Fixed when strata itself is compiled, like everything else in its BMI: a consumer's own NDEBUG does not reach code instantiated from here.