Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches
allocator_traits.hpp File Reference
#include <helios/memory/common.hpp>
#include <algorithm>
#include <concepts>
#include <cstddef>
#include <expected>
#include <memory_resource>
#include <span>

Go to the source code of this file.

Namespaces

namespace  helios
namespace  helios::mem

Concepts

concept  helios::mem::PmrAllocator
 Concept for PMR resources used by the memory module.
concept  helios::mem::PmrAllocatorWithStats
 Concept for PMR resources that expose allocator statistics.
concept  helios::mem::ResettablePmrAllocator
 Concept for PMR resources that support reset.

Functions

template<typename T, PmrAllocator Alloc>
auto helios::mem::TryAllocate (Alloc &allocator) noexcept -> std::expected< T *, MemoryError >
 Tries to allocate one object from a PMR allocator.
template<typename T, PmrAllocator Alloc>
auto helios::mem::TryAllocateSpan (Alloc &allocator, size_t count) noexcept -> std::expected< std::span< T >, MemoryError >
 Tries to allocate an array of objects from a PMR allocator.
template<typename T, PmrAllocator Alloc>
void helios::mem::Deallocate (Alloc &allocator, T *ptr) noexcept
 Deallocates an object allocated by TryAllocate.
template<typename T, PmrAllocator Alloc>
void helios::mem::Deallocate (Alloc &allocator, std::span< T > span) noexcept
 Deallocates an array allocated by TryAllocateSpan.
template<PmrAllocator Alloc>
constexpr AllocatorStats helios::mem::Stats (const Alloc &allocator) noexcept
 Adapts stats-aware PMR resources.