|
Stratax 0.2.0
|
Functions | |
| std::size_t | nonnegative_size (std::ptrdiff_t value, const char *message) |
| Converts a signed value to std::size_t after rejecting negatives. | |
| void | require_rank (std::size_t actual, std::size_t expected, const char *message) |
| Requires a rank value to match an expected rank. | |
| template<typename Ranked> requires requires(const Ranked& object) { object.rank(); } | |
| const Ranked & | require_rank (const Ranked &object, std::size_t expected, const char *message) |
| Requires an object with rank() to match an expected rank. | |
| std::size_t | checked_multiply (std::size_t lhs, std::size_t rhs, const char *message) |
| Multiplies two sizes while checking for overflow. | |
| std::size_t | checked_add (std::size_t lhs, std::size_t rhs, const char *message) |
| Adds two sizes while checking for overflow. | |
| std::size_t | nonnegative_index (std::ptrdiff_t value, const char *message) |
| Converts a signed index to std::size_t after rejecting negatives. | |
| std::size_t | normalize_index (std::ptrdiff_t value, std::size_t size, const char *message) |
| Normalizes a potentially negative index against a container size. | |
| void | require_index (std::size_t index, std::size_t size, const char *message) |
| Requires an index to be less than a size. | |
| 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. | |
| std::size_t | nonnegative_shape_dimension (std::ptrdiff_t value, const char *message) |
| Converts a signed shape dimension to std::size_t after rejecting negatives. | |
| std::size_t | positive_shape_dimension (std::ptrdiff_t value, const char *message) |
| Converts a signed shape dimension to std::size_t after requiring it to be positive. | |
| void | require_positive_shape_dimension (std::size_t value, const char *message) |
| Requires an unsigned shape dimension to be positive. | |
| template<typename Lhs, typename Rhs> | |
| bool | same_shape (const Lhs &lhs, const Rhs &rhs) |
| Returns whether two array-like objects have identical size and shape. | |
| template<typename Lhs, typename Rhs> | |
| void | require_same_shape (const Lhs &lhs, const Rhs &rhs, const char *message) |
| Requires two array-like objects to 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. | |
| template<typename Actual, typename Expected> | |
| void | require_type (const char *message) |
| Requires a type to exactly match an expected type after cv/ref removal. | |
| template<typename T> | |
| void | require_numeric_type (const char *message) |
| Requires a type to satisfy Stratax's numeric type rules. | |
| template<typename Lhs, typename Rhs> requires requires { typename Lhs::value_type; typename Rhs::value_type; } | |
| void | require_same_value_type (const Lhs &lhs, const Rhs &rhs, const char *message) |
| Requires two array-like objects to have the same value type. | |
|
inline |
Adds two sizes while checking for overflow.
| lhs | Left operand. |
| rhs | Right operand. |
| message | Error message used on overflow. |
| Exceptions::DimensionError | If the addition would overflow. |
Definition at line 104 of file DimensionValidation.hpp.
|
inline |
Multiplies two sizes while checking for overflow.
| lhs | Left operand. |
| rhs | Right operand. |
| message | Error message used on overflow. |
| Exceptions::DimensionError | If the multiplication would overflow. |
Definition at line 80 of file DimensionValidation.hpp.
|
inline |
Converts a signed index to std::size_t after rejecting negatives.
| value | Signed index to validate. |
| message | Error message used when value is negative. |
| Exceptions::IndexError | If value is negative. |
Definition at line 20 of file IndexValidation.hpp.
|
inline |
Converts a signed shape dimension to std::size_t after rejecting negatives.
| value | Signed dimension to validate. |
| message | Error message used when value is negative. |
| Exceptions::ShapeError | If value is negative. |
Definition at line 19 of file ShapeValidation.hpp.
|
inline |
Converts a signed value to std::size_t after rejecting negatives.
| value | Signed value to validate. |
| message | Error message used when value is negative. |
| Exceptions::DimensionError | If value is negative. |
Definition at line 20 of file DimensionValidation.hpp.
|
inline |
Normalizes a potentially negative index against a container size.
Negative indices are interpreted from the end of the range, like Python.
| value | Signed index value. |
| size | Container size used for normalization. |
| message | Error message used when the normalized index is out of bounds. |
| Exceptions::IndexError | If the index is out of bounds. |
Definition at line 43 of file IndexValidation.hpp.
|
inline |
Converts a signed shape dimension to std::size_t after requiring it to be positive.
| value | Signed dimension to validate. |
| message | Error message used when value <= 0. |
| Exceptions::ShapeError | If value <= 0. |
Definition at line 39 of file ShapeValidation.hpp.
|
inline |
Requires a value to be less than or equal to an upper bound.
This is useful for half-open range stops, where stop == size is valid.
| value | Value to validate. |
| upper | Inclusive upper bound. |
| message | Error message used when value > upper. |
| Exceptions::IndexError | If value > upper. |
Definition at line 94 of file IndexValidation.hpp.
|
inline |
Requires two sizes to be equal.
| lhs | Left size. |
| rhs | Right size. |
| message | Error message used on mismatch. |
| Exceptions::ShapeError | If the sizes differ. |
Definition at line 106 of file ShapeValidation.hpp.
|
inline |
Requires an index to be less than a size.
| index | Index to validate. |
| size | Exclusive upper bound. |
| message | Error message used when out of bounds. |
| Exceptions::IndexError | If index >= size. |
Definition at line 75 of file IndexValidation.hpp.
| void stratax::core::validation::require_numeric_type | ( | const char * | message | ) |
Requires a type to satisfy Stratax's numeric type rules.
| T | Type being validated. |
| message | Error message used when the type is unsupported. |
| Exceptions::TypeError | If T is not a supported numeric type. |
Definition at line 37 of file TypeValidation.hpp.
|
inline |
Requires an unsigned shape dimension to be positive.
| value | Dimension to validate. |
| message | Error message used when value == 0. |
| Exceptions::ShapeError | If value == 0. |
Definition at line 57 of file ShapeValidation.hpp.
| const Ranked & stratax::core::validation::require_rank | ( | const Ranked & | object, |
| std::size_t | expected, | ||
| const char * | message ) |
Requires an object with rank() to match an expected rank.
| object | Object to validate. |
| expected | Required rank. |
| message | Error message used on mismatch. |
| Exceptions::DimensionError | If the object rank differs. |
Definition at line 63 of file DimensionValidation.hpp.
|
inline |
Requires a rank value to match an expected rank.
| actual | Actual rank. |
| expected | Required rank. |
| message | Error message used on mismatch. |
| Exceptions::DimensionError | If the ranks differ. |
Definition at line 39 of file DimensionValidation.hpp.
| void stratax::core::validation::require_same_shape | ( | const Lhs & | lhs, |
| const Rhs & | rhs, | ||
| const char * | message ) |
Requires two array-like objects to have identical size and shape.
| lhs | Left object. |
| rhs | Right object. |
| message | Error message used on mismatch. |
| Exceptions::ShapeError | If size or shape differ. |
Definition at line 89 of file ShapeValidation.hpp.
| void stratax::core::validation::require_same_value_type | ( | const Lhs & | lhs, |
| const Rhs & | rhs, | ||
| const char * | message ) |
Requires two array-like objects to have the same value type.
| lhs | Left object. |
| rhs | Right object. |
| message | Error message used on mismatch. |
| Exceptions::TypeError | If the objects' normalized value_types differ. |
Definition at line 60 of file TypeValidation.hpp.
| void stratax::core::validation::require_type | ( | const char * | message | ) |
Requires a type to exactly match an expected type after cv/ref removal.
| Actual | Type being validated. |
| Expected | Required type. |
| message | Error message used on mismatch. |
| Exceptions::TypeError | If the normalized types differ. |
Definition at line 20 of file TypeValidation.hpp.
|
nodiscard |
Returns whether two array-like objects have identical size and shape.
| lhs | Left object. |
| rhs | Right object. |
Definition at line 74 of file ShapeValidation.hpp.