26template<
typename Actual,
typename Expected>
29 if constexpr (!std::same_as<std::remove_cvref_t<Actual>, std::remove_cvref_t<Expected>>)
61template<
typename Lhs,
typename Rhs>
64 typename Lhs::value_type;
65 typename Rhs::value_type;
89 return static_cast<std::size_t
>(value);
109 return static_cast<std::size_t
>(value);
129 return static_cast<std::size_t
>(value);
165 return static_cast<std::size_t
>(value);
177inline void require_rank(std::size_t actual, std::size_t expected,
const char* message)
179 if (actual != expected)
196template<
typename Ranked>
197requires requires(
const Ranked& object)
201const Ranked&
require_rank(
const Ranked&
object, std::size_t expected,
const char* message)
216inline void require_index(std::size_t index, std::size_t size,
const char* message)
259 if (rhs != 0 && lhs > std::numeric_limits<std::size_t>::max() / rhs)
283 if (lhs > std::numeric_limits<std::size_t>::max() - rhs)
299template<
typename Lhs,
typename Rhs>
302 return lhs.size() == rhs.size() && lhs.shape() == rhs.shape();
314template<
typename Lhs,
typename Rhs>
Signals an invalid dimension count or dimension arithmetic failure.
Signals an invalid index access.
Signals an invalid or incompatible shape.
Signals an invalid or unsupported type.
Matches all scalar types supported by Stratax numeric containers.
std::size_t checked_multiply(std::size_t lhs, std::size_t rhs, const char *message)
Multiplies two sizes while checking for overflow.
void require_same_value_type(const Lhs &, const Rhs &, const char *message)
Requires two array-like objects to have the same value type.
void require_same_shape(const Lhs &lhs, const Rhs &rhs, const char *message)
Requires two array-like objects to have identical size and shape.
std::size_t nonnegative_index(long long value, const char *message)
Converts a signed index to std::size_t after rejecting negatives.
bool same_shape(const Lhs &lhs, const Rhs &rhs)
Returns whether two array-like objects have identical size and shape.
void require_equal_size(std::size_t lhs, std::size_t rhs, const char *message)
Requires two sizes to be equal.
std::size_t nonnegative_size(long long value, const char *message)
Converts a signed value to std::size_t after rejecting negatives.
void require_index(std::size_t index, std::size_t size, const char *message)
Requires an index to be less than a size.
std::size_t positive_shape_dimension(long long value, const char *message)
Converts a signed shape dimension to std::size_t after requiring it to be positive.
void require_at_most(std::size_t value, std::size_t upper, const char *message)
Requires a value to be less than or equal to an upper bound.
void require_positive_shape_dimension(std::size_t value, const char *message)
Requires an unsigned shape dimension to be positive.
void require_rank(std::size_t actual, std::size_t expected, const char *message)
Requires a rank value to match an expected rank.
void require_type(const char *message)
Requires a type to exactly match an expected type after cv/ref removal.
void require_numeric_type(const char *message)
Requires a type to satisfy Stratax's numeric type rules.
std::size_t nonnegative_shape_dimension(long long value, const char *message)
Converts a signed shape dimension to std::size_t after rejecting negatives.
std::size_t checked_add(std::size_t lhs, std::size_t rhs, const char *message)
Adds two sizes while checking for overflow.