HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions
v1::stable_set< Key > Class Template Reference

#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_setoperator= (stable_set const &)=delete
 
stable_setoperator= (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.
 

Detailed Description

template<typename Key>
class v1::stable_set< Key >

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.

Member Typedef Documentation

◆ map_type

template<typename Key >
using v1::stable_set< Key >::map_type

Member Function Documentation

◆ emplace()

template<typename Key >
template<typename... Args>
size_t v1::stable_set< Key >::emplace ( Args &&... args)
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.

Parameters
argsThe arguments to pass to the constructor of the value_type.
Returns
The index where the object was added, or where the object already was in the set.

◆ insert()

template<typename Key >
template<typename Arg >
requires (std::is_same_v<std::decay_t<Arg>, value_type>)
size_t v1::stable_set< Key >::insert ( Arg && arg)
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.

Parameters
argThe object to add.
Returns
The index where the object was added, or where the object already was in the set.

◆ operator[]()

template<typename Key >
const_reference v1::stable_set< Key >::operator[] ( size_t index) const
inlinenoexcept

Get a const reference to an object located at an index in the set.

Note
It is undefined behavior if the index is not in the set.
Parameters
indexThe index in the set of an existing object.
Returns
A const reference to an existing object in the set.

The documentation for this class was generated from the following file: