|
| constexpr std::optional< Error > | insert (const KeyType &key, const ValueType &value) noexcept |
| | Inserts a key-value pair into the map.
|
| |
|
constexpr std::optional< Error > | insert (const std::pair< KeyType, ValueType > &p) noexcept |
| |
| constexpr bool | remove (const KeyType &key) noexcept |
| | Removes a key and its value from the map.
|
| |
| constexpr std::optional< ValueField * > | at (const KeyType &key) noexcept |
| | Get reference to value by key.
|
| |
|
constexpr std::size_t | size () const noexcept |
| | Get the current number of elements.
|
| |
|
constexpr bool | empty () const noexcept |
| | Check if the map is empty.
|
| |
|
constexpr void | clear () noexcept |
| | Clear the map.
|
| |
|
constexpr auto | Validate () const noexcept -> std::optional< Error > |
| | Validate the map and its elements.
|
| |
| constexpr bool | operator== (const MapField &other) const noexcept |
| | Checks if two maps are equal (set equality).
|
| |
|
auto | begin () const noexcept |
| |
|
auto | end () const noexcept |
| |
|
auto | begin () noexcept |
| |
|
auto | end () noexcept |
| |
template<FieldId Id, typename KeyField, typename ValueField, std::size_t MaxSize, typename... Validators>
class Crunch::messages::MapField< Id, KeyField, ValueField, MaxSize, Validators >
Map field mapping keys to values.
Backed by std::array<std::pair<KeyField, ValueField>, MaxSize>. Keys and Values are other Crunch fields.
- Template Parameters
-
| Id | The unique FieldId. |
| KeyField | The type of the key field. |
| ValueField | The type of the value field. |
| MaxSize | Maximum number of key-value pairs. |
| Validators | Validators to apply to the Map. |