|
| constexpr std::optional< Error > | add (const ElementType &val) noexcept |
| | Adds an element to the array.
|
| |
template<std::size_t N>
requires (N <= MaxSize) |
| constexpr std::optional< Error > | set (const std::array< ElementType, N > &other) noexcept |
| | Set array contents from a std::array.
|
| |
| constexpr std::optional< Error > | set (const ArrayField &other) noexcept |
| | Set array contents from another ArrayField.
|
| |
|
constexpr void | clear () noexcept |
| | Clear the array (sets size to 0).
|
| |
| constexpr std::size_t | size () const noexcept |
| | Get the current number of elements.
|
| |
| constexpr bool | empty () const noexcept |
| | Check if the array is empty.
|
| |
| constexpr auto | get () const noexcept |
| | Get read-only span of active elements.
|
| |
| constexpr const ElementType & | operator[] (std::size_t index) const noexcept |
| | Access element at index (unchecked).
|
| |
| constexpr const ElementType & | at (std::size_t index) const |
| | Access element at index.
|
| |
| constexpr auto | Validate () const noexcept -> std::optional< Error > |
| | Validates the array and its elements.
|
| |
|
constexpr bool | operator== (const ArrayField &other) const noexcept |
| |
|
auto | begin () const noexcept |
| |
|
auto | end () const noexcept |
| |
|
auto | begin () noexcept |
| |
|
auto | end () noexcept |
| |
template<FieldId Id, typename ElementType, std::size_t MaxSize, typename... Validators>
class Crunch::messages::ArrayField< Id, ElementType, MaxSize, Validators >
Concept for valid element types within Field or ArrayField.
Self-contained array field with storage, validation, and field metadata.
Arrays do not have Required/Optional presence - "set" is derived from size()
0. Use array-level validators like LengthAtLeast<N> instead.
- Template Parameters
-
| Id | The unique FieldId. |
| ElementType | The element type (Scalar, String, or Message). |
| MaxSize | Maximum number of elements. |
| Validators | Validators to apply to the Array (e.g., LengthAtLeast). |