koutil
|
A compile-time map implementation. More...
#include <comptime_map.h>
Public Types | |
using | pair_t = std::pair<Key, Value> |
using | pairs_t = std::array<pair_t, Size> |
Public Member Functions | |
consteval | ComptimeMap (pairs_t pairs) |
Constructs a compile-time map from an array of pairs. | |
consteval bool | contains_duplicate_key () const |
Checks if there are duplicate keys in the map. | |
constexpr std::size_t | find (const Key &key) const |
Finds the index of a key in the map. | |
constexpr const Value & | operator[] (const Key &key) const |
Retrieves the value associated with a key. | |
constexpr const Value & | at (const Key &key) const |
Retrieves the value associated with a key. | |
constexpr const Value & | safe_at (const Key &key, const Value &default_value) const |
Retrieves the value associated with a key or a default value if not found. | |
constexpr const Value & | unsafe_get (std::size_t index) const |
Retrieves the value at a specific index. | |
constexpr const pair_t & | get_pair (const Key &key) const |
Retrieves the key-value pair associated with a key. | |
constexpr bool | contains (const Key &key) const |
Checks if the map contains a key. | |
consteval bool | test_value (const Value &value) const |
Checks if a specific value exists in the map. | |
consteval bool | test_no_value (const Value &value) const |
Checks if a specific value does not exist in the map. | |
Static Public Attributes | |
static constexpr auto | npos = std::numeric_limits<std::size_t>::max() |
Private Attributes | |
pairs_t | m_data |
A compile-time map implementation.
Key | The key type. |
Value | The value type. |
Size | The size of the map. |
using koutil::container::ComptimeMap< Key, Value, Size >::pair_t = std::pair<Key, Value> |
using koutil::container::ComptimeMap< Key, Value, Size >::pairs_t = std::array<pair_t, Size> |
|
inlineconsteval |
Constructs a compile-time map from an array of pairs.
pairs | The array of key-value pairs. |
|
inlinenodiscardconstexpr |
Retrieves the value associated with a key.
key | The key. |
|
inlinenodiscardconstexpr |
Checks if the map contains a key.
key | The key to check. |
|
inlinenodiscardconsteval |
Checks if there are duplicate keys in the map.
|
inlinenodiscardconstexpr |
Finds the index of a key in the map.
key | The key to find. |
|
inlinenodiscardconstexpr |
Retrieves the key-value pair associated with a key.
key | The key. |
|
inlinenodiscardconstexpr |
Retrieves the value associated with a key.
key | The key. |
|
inlinenodiscardconstexpr |
Retrieves the value associated with a key or a default value if not found.
key | The key. |
default_value | The default value. |
|
inlinenodiscardconsteval |
Checks if a specific value does not exist in the map.
value | The value to check. |
|
inlinenodiscardconsteval |
Checks if a specific value exists in the map.
value | The value to check. |
|
inlinenodiscardconstexpr |
Retrieves the value at a specific index.
index | The index. |
|
private |
|
staticconstexpr |