|
|
Donner
C++20 SVG rendering library
|
Compile-time associative container backed by a perfect hash layout. More...
#include "donner/base/CompileTimeMap.h"
Public Types | |
| using | key_type = Key |
| using | mapped_type = Value |
| using | value_type = std::pair<Key, Value> |
| using | hasher = Hasher |
| using | key_equal = KeyEqual |
| using | size_type = std::size_t |
Public Member Functions | |
| constexpr | CompileTimeMap (const std::array< Key, N > &keys, const std::array< Value, N > &values, CompileTimeMapTables< N > tables, Hasher hasher=Hasher{}, KeyEqual keyEqual=KeyEqual{}) |
| Constructs a CompileTimeMap from precomputed tables and key/value arrays. | |
| constexpr size_type | size () const |
| Returns the number of entries tracked by the map. | |
| constexpr bool | empty () const |
| Returns true when the map contains no elements. | |
| constexpr const Value * | find (const Key &key) const |
| Returns a pointer to the mapped value when the key exists, or nullptr otherwise. | |
| constexpr bool | contains (const Key &key) const |
| Returns true when the map contains the provided key. | |
| constexpr const Value & | at (const Key &key) const |
| Returns a reference to the mapped value or triggers a release assertion if missing. | |
| constexpr const std::array< Key, N > & | keys () const |
| Returns the compile-time key array, preserving insertion order. | |
| constexpr CompileTimeMapTables< N > | tables () const |
| Returns the perfect-hash tables used for lookup. | |
Static Public Attributes | |
| static constexpr size_type | kSize = N |
Compile-time associative container backed by a perfect hash layout.