Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
helios::container Namespace Reference

Namespaces

namespace  details

Classes

class  BasicStaticString
 A fixed-capacity string class that owns its storage. More...
class  CallableBufferArrayImpl
 Implementation class for an inline callable array buffer with explicit allocator. More...
class  CallableBufferImpl
 Implementation class for a single-instance callable buffer with explicit allocator. More...
class  MultiTypeMap
 Generic type-indexed map that stores one Storage instance per registered type key. More...
class  SparseSet
 A sparse set data structure for efficient mapping of sparse indices to dense storage of values. More...
class  TypedBuffer
 Type-erased single-instance byte storage. More...
class  TypedBufferArray
 Type-erased sequential byte storage for a single type (array variant). More...

Typedefs

template<typename... Args>
using CallableBuffer = typename details::CallableBufferDeducer<Args...>::type
 Single-instance callable buffer with type-erased invocation.
template<typename... Signatures>
using PmrCallableBuffer
 Single-instance callable buffer with type-erased invocation with polymorphic allocator.
template<typename... Args>
using CallableBufferArray
 Inline storage for heterogeneous callable instances with type-erased invocation.
template<typename... Signatures>
using PmrCallableBufferArray
 Inline storage for heterogeneous callable instances with type-erased invocation with polymorphic allocator.
template<typename Storage>
using PmrMultiTypeMap
template<typename T, typename IndexType = size_t>
using PmrSparseSet
template<size_t N>
using StaticString = BasicStaticString<N, char>
 Fixed-capacity string of char.
template<size_t N>
using StaticWString = BasicStaticString<N, wchar_t>
 Fixed-capacity string of wchar_t.
template<size_t N>
using StaticU8String = BasicStaticString<N, char8_t>
 Fixed-capacity string of char8_t.
template<size_t N>
using StaticU16String = BasicStaticString<N, char16_t>
 Fixed-capacity string of char16_t.
template<size_t N>
using StaticU32String = BasicStaticString<N, char32_t>
 Fixed-capacity string of char32_t.
using PmrTypedBuffer = TypedBuffer<std::pmr::polymorphic_allocator<std::byte>>
using PmrTypedBufferArray

Functions

template<size_t N1, size_t N2, typename CharT, typename Traits>
constexpr auto operator+ (const BasicStaticString< N1, CharT, Traits > &lhs, const BasicStaticString< N2, CharT, Traits > &rhs) noexcept -> BasicStaticString< N1+N2, CharT, Traits >
 Concatenates two StaticStrings.
template<size_t N, typename CharT, typename Traits>
constexpr auto operator+ (const BasicStaticString< N, CharT, Traits > &lhs, std::basic_string_view< CharT, Traits > rhs) noexcept -> BasicStaticString< N, CharT, Traits >
 Concatenates StaticString with std::basic_string_view.
template<size_t N, typename CharT, typename Traits>
constexpr auto operator+ (std::basic_string_view< CharT, Traits > lhs, const BasicStaticString< N, CharT, Traits > &rhs) noexcept -> BasicStaticString< N, CharT, Traits >
 Concatenates std::basic_string_view with StaticString.
template<size_t N, typename CharT, typename Traits>
constexpr auto operator+ (const BasicStaticString< N, CharT, Traits > &lhs, CharT rhs) noexcept -> BasicStaticString< N, CharT, Traits >
 Concatenates StaticString with character.
template<size_t N, typename CharT, typename Traits>
constexpr auto operator+ (CharT lhs, const BasicStaticString< N, CharT, Traits > &rhs) noexcept -> BasicStaticString< N, CharT, Traits >
 Concatenates character with StaticString.
template<size_t StrCapacity, typename CharT, typename Traits>
constexpr void swap (BasicStaticString< StrCapacity, CharT, Traits > &lhs, BasicStaticString< StrCapacity, CharT, Traits > &rhs) noexcept
 Swaps two BasicStaticStrings.
template<size_t StrCapacity, typename CharT, typename Traits>
constexpr auto erase (BasicStaticString< StrCapacity, CharT, Traits > &str, CharT value) noexcept -> typename BasicStaticString< StrCapacity, CharT, Traits >::size_type
 Erases all elements equal to value.
template<size_t StrCapacity, typename CharT, typename Traits, typename Pred>
constexpr auto erase_if (BasicStaticString< StrCapacity, CharT, Traits > &str, Pred pred) noexcept -> typename BasicStaticString< StrCapacity, CharT, Traits >::size_type
 Erases all elements satisfying predicate.
template<size_t StrCapacity, typename CharT, typename Traits>
auto operator<< (std::basic_ostream< CharT, Traits > &os, const BasicStaticString< StrCapacity, CharT, Traits > &str) -> std::basic_ostream< CharT, Traits > &
 Outputs a BasicStaticString to an output stream.
template<size_t StrCapacity, typename CharT, typename Traits>
auto operator>> (std::basic_istream< CharT, Traits > &is, BasicStaticString< StrCapacity, CharT, Traits > &str) -> std::basic_istream< CharT, Traits > &
 Inputs a BasicStaticString from an input stream.
template<TypedBufferStorable T, typename Allocator>
requires (std::is_class_v<Allocator> && !std::same_as<std::remove_cvref_t<T>, typename TypedBufferArray<Allocator>::size_type>)
auto erase (TypedBufferArray< Allocator > &storage, const T &value) -> typename TypedBufferArray< Allocator >::size_type
 Erases all elements equal to value from the TypedBufferArray.
template<typename Allocator>
requires std::is_class_v<Allocator>
void erase (TypedBufferArray< Allocator > &storage, typename TypedBufferArray< Allocator >::size_type pos)
 Erases the element at position pos from the TypedBufferArray (swap-then-pop, O(1), unstable).
template<TypedBufferStorable T, typename Allocator, typename Pred>
requires (std::is_class_v<Allocator> && std::predicate<Pred, const T&>)
auto erase_if (TypedBufferArray< Allocator > &storage, Pred pred) -> typename TypedBufferArray< Allocator >::size_type
 Erases all elements satisfying the predicate from the TypedBufferArray.

Typedef Documentation

◆ CallableBuffer

template<typename... Args>
using helios::container::CallableBuffer = typename details::CallableBufferDeducer<Args...>::type

Single-instance callable buffer with type-erased invocation.

Stores exactly one callable of any type in a contiguous byte buffer with embedded function pointers for type-safe dispatch. Optimized for use-cases where a single command or handler needs to be stored and invoked without virtual dispatch or heap allocation per instance.

The allocator parameter is optional. If the first template argument is a function signature (void(Args...)), the default allocator is used. Otherwise, the first argument is treated as an allocator.

Template Parameters
ArgsEither signatures only, or allocator followed by signatures
// Single operation
CallableBuffer<void(World&)> cmd;
cmd.Set(SpawnEntityCmd{entity});
cmd.Invoke(world);
// Multiple operations
CallableBuffer<void(World&), void(Logger&)> multi_cmd;
multi_cmd.Set<&Cmd::Execute, &Cmd::Log>(Cmd{data});
multi_cmd.Invoke<0>(world);
multi_cmd.Invoke<1>(logger);
typename details::CallableBufferDeducer< Args... >::type CallableBuffer
Single-instance callable buffer with type-erased invocation.

Definition at line 563 of file callable_buffer.hpp.

◆ CallableBufferArray

template<typename... Args>
using helios::container::CallableBufferArray
Initial value:
typename details::CallableBufferArrayDeducer<Args...>::type
Deduces the CallableBufferArrayImpl type from signature arguments.

Inline storage for heterogeneous callable instances with type-erased invocation.

Stores callable instances of different types in a single contiguous buffer with embedded function pointers for type-safe invocation. Optimized for fast sequential iteration without virtual dispatch or per-callable heap allocations.

The allocator parameter is optional. If the first template argument is a function signature (void(Args...)), the default allocator is used. Otherwise, the first argument is treated as an allocator.

Template Parameters
ArgsEither signatures only, or allocator followed by signatures
// Single operation with default allocator (most common usage)
CallableBufferArray<void(World&)> commands;
commands.Push(SpawnEntityCmd{entity});
commands.Invoke(world);
// Multiple operations
CallableBufferArray<void(World&), void(Logger&)> multi;
multi.Push<&Cmd::Execute, &Cmd::Log>(Cmd{data});
multi.Invoke<0>(world);
multi.Invoke<1>(logger);
typename details::CallableBufferArrayDeducer< Args... >::type CallableBufferArray
Inline storage for heterogeneous callable instances with type-erased invocation.

Definition at line 718 of file callable_buffer_array.hpp.

◆ PmrCallableBuffer

template<typename... Signatures>
using helios::container::PmrCallableBuffer
Initial value:
Signatures...>
Implementation class for a single-instance callable buffer with explicit allocator.

Single-instance callable buffer with type-erased invocation with polymorphic allocator.

Stores exactly one callable of any type in a contiguous byte buffer with embedded function pointers for type-safe dispatch. Optimized for use-cases where a single command or handler needs to be stored and invoked without virtual dispatch or heap allocation per instance.

The allocator parameter is optional. If the first template argument is a function signature (void(Args...)), the default allocator is used. Otherwise, the first argument is treated as an allocator.

Template Parameters
ArgsFunction signatures in the form void(Args...) for the operations to support.
// Single operation
PmrCallableBuffer<void(World&)> cmd(&resource);
cmd.Set(SpawnEntityCmd{entity});
cmd.Invoke(world);
// Multiple operations
PmrCallableBuffer<void(World&), void(Logger&)> multi_cmd(&resource);
multi_cmd.Set<&Cmd::Execute, &Cmd::Log>(Cmd{data});
multi_cmd.Invoke<0>(world);
multi_cmd.Invoke<1>(logger);
CallableBufferImpl< std::pmr::polymorphic_allocator< std::byte >, Signatures... > PmrCallableBuffer
Single-instance callable buffer with type-erased invocation with polymorphic allocator.

Definition at line 594 of file callable_buffer.hpp.

◆ PmrCallableBufferArray

template<typename... Signatures>
using helios::container::PmrCallableBufferArray
Initial value:
Signatures...>
Implementation class for an inline callable array buffer with explicit allocator.

Inline storage for heterogeneous callable instances with type-erased invocation with polymorphic allocator.

Stores callable instances of different types in a single contiguous buffer with embedded function pointers for type-safe invocation. Optimized for fast sequential iteration without virtual dispatch or per-callable heap allocations.

The allocator parameter is optional. If the first template argument is a function signature (void(Args...)), the default allocator is used. Otherwise, the first argument is treated as an allocator.

Template Parameters
ArgsFunction signatures in the form void(Args...) for the operations to support.
// Single operation
PmrCallableBufferArray<void(World&)> commands(&resource);
commands.Push(SpawnEntityCmd{entity});
commands.Invoke(world);
// Multiple operations
PmrCallableBufferArray<void(World&), void(Logger&)> multi(&resource);
multi.Push<&Cmd::Execute, &Cmd::Log>(Cmd{data});
multi.Invoke<0>(world);
multi.Invoke<1>(logger);
CallableBufferArrayImpl< std::pmr::polymorphic_allocator< std::byte >, Signatures... > PmrCallableBufferArray
Inline storage for heterogeneous callable instances with type-erased invocation with polymorphic allo...

Definition at line 750 of file callable_buffer_array.hpp.

◆ PmrMultiTypeMap

template<typename Storage>
using helios::container::PmrMultiTypeMap
Initial value:
Generic type-indexed map that stores one Storage instance per registered type key.

Definition at line 778 of file multi_type_map.hpp.

◆ PmrSparseSet

template<typename T, typename IndexType = size_t>
using helios::container::PmrSparseSet
Initial value:
A sparse set data structure for efficient mapping of sparse indices to dense storage of values.

Definition at line 819 of file sparse_set.hpp.

◆ PmrTypedBuffer

using helios::container::PmrTypedBuffer = TypedBuffer<std::pmr::polymorphic_allocator<std::byte>>

Definition at line 460 of file typed_buffer.hpp.

◆ PmrTypedBufferArray

Initial value:
Type-erased sequential byte storage for a single type (array variant).

Definition at line 1735 of file typed_buffer_array.hpp.

◆ StaticString

template<size_t N>
using helios::container::StaticString = BasicStaticString<N, char>

Fixed-capacity string of char.

Template Parameters
NMaximum capacity

Definition at line 1567 of file static_string.hpp.

◆ StaticU16String

template<size_t N>
using helios::container::StaticU16String = BasicStaticString<N, char16_t>

Fixed-capacity string of char16_t.

Template Parameters
NMaximum capacity

Definition at line 1588 of file static_string.hpp.

◆ StaticU32String

template<size_t N>
using helios::container::StaticU32String = BasicStaticString<N, char32_t>

Fixed-capacity string of char32_t.

Template Parameters
NMaximum capacity

Definition at line 1595 of file static_string.hpp.

◆ StaticU8String

template<size_t N>
using helios::container::StaticU8String = BasicStaticString<N, char8_t>

Fixed-capacity string of char8_t.

Template Parameters
NMaximum capacity

Definition at line 1581 of file static_string.hpp.

◆ StaticWString

template<size_t N>
using helios::container::StaticWString = BasicStaticString<N, wchar_t>

Fixed-capacity string of wchar_t.

Template Parameters
NMaximum capacity

Definition at line 1574 of file static_string.hpp.

Function Documentation

◆ erase() [1/3]

template<size_t StrCapacity, typename CharT, typename Traits>
auto helios::container::erase ( BasicStaticString< StrCapacity, CharT, Traits > & str,
CharT value ) -> typename BasicStaticString< StrCapacity, CharT, Traits >::size_type
constexprnoexcept

Erases all elements equal to value.

Template Parameters
StrCapacityStrCapacity of the string
CharTCharacter type
TraitsCharacter traits
Parameters
strString to modify
valueValue to erase
Returns
Number of elements erased

Definition at line 1721 of file static_string.hpp.

◆ erase() [2/3]

template<TypedBufferStorable T, typename Allocator>
requires (std::is_class_v<Allocator> && !std::same_as<std::remove_cvref_t<T>, typename TypedBufferArray<Allocator>::size_type>)
auto helios::container::erase ( TypedBufferArray< Allocator > & storage,
const T & value ) -> typename TypedBufferArray< Allocator >::size_type
inline

Erases all elements equal to value from the TypedBufferArray.

Uses the swap-then-pop pattern for each match. Element order is not preserved.

Template Parameters
TThe element type
AllocatorThe allocator type
Parameters
storageThe buffer to erase from
valueThe value to erase
Returns
Number of elements erased

Definition at line 1752 of file typed_buffer_array.hpp.

◆ erase() [3/3]

template<typename Allocator>
requires std::is_class_v<Allocator>
void helios::container::erase ( TypedBufferArray< Allocator > & storage,
typename TypedBufferArray< Allocator >::size_type pos )
inline

Erases the element at position pos from the TypedBufferArray (swap-then-pop, O(1), unstable).

Template Parameters
AllocatorThe allocator type
Parameters
storageThe buffer to erase from
posIndex of the element to erase

Definition at line 1781 of file typed_buffer_array.hpp.

◆ erase_if() [1/2]

template<size_t StrCapacity, typename CharT, typename Traits, typename Pred>
auto helios::container::erase_if ( BasicStaticString< StrCapacity, CharT, Traits > & str,
Pred pred ) -> typename BasicStaticString< StrCapacity, CharT, Traits >::size_type
constexprnoexcept

Erases all elements satisfying predicate.

Template Parameters
StrCapacityStrCapacity of the string
CharTCharacter type
TraitsCharacter traits
PredPredicate type
Parameters
strString to modify
predUnary predicate
Returns
Number of elements erased

Definition at line 1743 of file static_string.hpp.

◆ erase_if() [2/2]

template<TypedBufferStorable T, typename Allocator, typename Pred>
requires (std::is_class_v<Allocator> && std::predicate<Pred, const T&>)
auto helios::container::erase_if ( TypedBufferArray< Allocator > & storage,
Pred pred ) -> typename TypedBufferArray< Allocator >::size_type
inline

Erases all elements satisfying the predicate from the TypedBufferArray.

Uses the swap-then-pop pattern. Element order is not preserved.

Template Parameters
TThe element type
AllocatorThe allocator type
PredPredicate type
Parameters
storageThe buffer to erase from
predPredicate to test elements
Returns
Number of elements erased

Definition at line 1800 of file typed_buffer_array.hpp.

◆ operator+() [1/5]

template<size_t N, typename CharT, typename Traits>
auto helios::container::operator+ ( CharT lhs,
const BasicStaticString< N, CharT, Traits > & rhs ) -> BasicStaticString< N, CharT, Traits >
nodiscardconstexprnoexcept

Concatenates character with StaticString.

Warning
Triggers assertion if rhs.Size() >= N.
Template Parameters
NStrCapacity of the static string
CharTCharacter type
TraitsCharacter traits
Parameters
lhsCharacter
rhsStatic string
Returns
Concatenated string (same capacity as rhs)

Definition at line 1688 of file static_string.hpp.

◆ operator+() [2/5]

template<size_t N, typename CharT, typename Traits>
auto helios::container::operator+ ( const BasicStaticString< N, CharT, Traits > & lhs,
CharT rhs ) -> BasicStaticString< N, CharT, Traits >
nodiscardconstexprnoexcept

Concatenates StaticString with character.

Warning
Triggers assertion if lhs.Size() >= N.
Template Parameters
NStrCapacity of the static string
CharTCharacter type
TraitsCharacter traits
Parameters
lhsStatic string
rhsCharacter
Returns
Concatenated string (same capacity as lhs)

Definition at line 1669 of file static_string.hpp.

◆ operator+() [3/5]

template<size_t N, typename CharT, typename Traits>
auto helios::container::operator+ ( const BasicStaticString< N, CharT, Traits > & lhs,
std::basic_string_view< CharT, Traits > rhs ) -> BasicStaticString< N, CharT, Traits >
nodiscardconstexprnoexcept

Concatenates StaticString with std::basic_string_view.

Warning
Triggers assertion if combined length > N.
Template Parameters
NStrCapacity of the static string
CharTCharacter type
TraitsCharacter traits
Parameters
lhsStatic string
rhsString view
Returns
Concatenated string (same capacity as lhs)

Definition at line 1629 of file static_string.hpp.

◆ operator+() [4/5]

template<size_t N1, size_t N2, typename CharT, typename Traits>
auto helios::container::operator+ ( const BasicStaticString< N1, CharT, Traits > & lhs,
const BasicStaticString< N2, CharT, Traits > & rhs ) -> BasicStaticString< N1+N2, CharT, Traits >
nodiscardconstexprnoexcept

Concatenates two StaticStrings.

Template Parameters
N1StrCapacity of first string
N2StrCapacity of second string
CharTCharacter type
TraitsCharacter traits
Parameters
lhsFirst string
rhsSecond string
Returns
Concatenated string with capacity N1 + N2

Definition at line 1608 of file static_string.hpp.

◆ operator+() [5/5]

template<size_t N, typename CharT, typename Traits>
auto helios::container::operator+ ( std::basic_string_view< CharT, Traits > lhs,
const BasicStaticString< N, CharT, Traits > & rhs ) -> BasicStaticString< N, CharT, Traits >
nodiscardconstexprnoexcept

Concatenates std::basic_string_view with StaticString.

Warning
Triggers assertion if combined length > N.
Template Parameters
NStrCapacity of the static string
CharTCharacter type
TraitsCharacter traits
Parameters
lhsString view
rhsStatic string
Returns
Concatenated string (same capacity as rhs)

Definition at line 1649 of file static_string.hpp.

◆ operator<<()

template<size_t StrCapacity, typename CharT, typename Traits>
auto helios::container::operator<< ( std::basic_ostream< CharT, Traits > & os,
const BasicStaticString< StrCapacity, CharT, Traits > & str ) -> std::basic_ostream< CharT, Traits > &
inline

Outputs a BasicStaticString to an output stream.

Template Parameters
StrCapacityStrCapacity of the string
CharTCharacter type
TraitsCharacter traits
Parameters
osOutput stream
strString to output
Returns
Reference to the output stream

Definition at line 1764 of file static_string.hpp.

◆ operator>>()

template<size_t StrCapacity, typename CharT, typename Traits>
auto helios::container::operator>> ( std::basic_istream< CharT, Traits > & is,
BasicStaticString< StrCapacity, CharT, Traits > & str ) -> std::basic_istream< CharT, Traits > &
inline

Inputs a BasicStaticString from an input stream.

Template Parameters
StrCapacityStrCapacity of the string
CharTCharacter type
TraitsCharacter traits
Parameters
isInput stream
strString to input
Returns
Reference to the input stream

Definition at line 1780 of file static_string.hpp.

◆ swap()

template<size_t StrCapacity, typename CharT, typename Traits>
void helios::container::swap ( BasicStaticString< StrCapacity, CharT, Traits > & lhs,
BasicStaticString< StrCapacity, CharT, Traits > & rhs )
constexprnoexcept

Swaps two BasicStaticStrings.

Template Parameters
StrCapacityStrCapacity of the strings
CharTCharacter type
TraitsCharacter traits
Parameters
lhsFirst string
rhsSecond string

Definition at line 1705 of file static_string.hpp.