HikoGUI
A low latency retained GUI
|
#include <hikogui/container/stable_set.hpp>
Public Types | |
using | value_type = Key |
using | size_type = size_t |
using | map_type |
using | key_type = Key |
using | difference_type = ptrdiff_t |
using | reference = value_type const& |
using | const_reference = value_type const& |
using | pointer = value_type const * |
using | const_pointer = value_type const * |
Public Member Functions | |
stable_set (stable_set const &)=delete | |
stable_set (stable_set &&)=delete | |
stable_set & | operator= (stable_set const &)=delete |
stable_set & | operator= (stable_set &&)=delete |
size_t | size () const noexcept |
bool | empty () const noexcept |
operator bool () const noexcept | |
const_reference | operator[] (size_t index) const noexcept |
Get a const reference to an object located at an index in the set. | |
template<typename Arg > requires (std::is_same_v<std::decay_t<Arg>, value_type>) | |
size_t | insert (Arg &&arg) noexcept |
Insert an object into the stable-set. | |
template<typename... Args> | |
size_t | emplace (Args &&...args) noexcept |
Emplace an object into the stable-set. | |
This is a set of object with stable indices.
This container holds a set of unique objects, associated with a stable index.
Currently the main use case is for grapheme
. Where it stores multi code-point graphemes into the stable_set, while holding the index in the grapheme
object.
Another use case is for text_style
objects which only hold an index while the actual_text_style
objects are stored in the stable_set.
using v1::stable_set< Key >::map_type |
|
inlinenoexcept |
Emplace an object into the stable-set.
Create a new object into the set and return the index where it was inserted. If an equivalent object is already in the set then the index is returned where it was located, and the temporary created object is destroyed.
args | The arguments to pass to the constructor of the value_type. |
|
inlinenoexcept |
Insert an object into the stable-set.
Forward the given object into the set and return the index where it was inserted. If the object is already in the set then the index is returned where it was located, and the temporary created object is destroyed.
arg | The object to add. |
|
inlinenoexcept |
Get a const reference to an object located at an index in the set.
index | The index in the set of an existing object. |