ttx 0.1.0
|
A two-way map between a numberic id and a value. More...
#include <ttx/terminal/id_map.h>
Public Types | |
using | Id = u16 |
using | Key = typename Ops::Key |
Public Member Functions | |
auto | lookup_id (Id id) const -> T const & |
auto | lookup_key (Key const &key) const -> di::Optional< Id > |
auto | allocate (T const &value) -> di::Optional< Id > requires(di::concepts::CopyConstructible< T >) |
auto | allocate (T &&value) -> di::Optional< Id > |
auto | use_id (Id id) -> Id |
void | drop_id (Id id) |
Static Public Attributes | |
static constexpr auto | max_id = di::NumericLimits<Id>::max |
A two-way map between a numberic id and a value.
T | The value type |
Ops | An operation struct, which can be used to define a custom key. |
This class implements the two way mapping behavior which deduplicates graphics renditions and other cell specific state across cells. This implemenation uses manual reference counting, which is non-ideal for C++, but seems necessary for performance.
using ttx::terminal::IdMap< T, Ops >::Id = u16 |
using ttx::terminal::IdMap< T, Ops >::Key = typename Ops::Key |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
staticconstexpr |