Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::memory::AllocationResult Struct Reference

Result type for allocation operations. More...

#include <allocator_traits.hpp>

Public Member Functions

constexpr bool Valid () const noexcept
 Checks if the allocation was successful.
 

Public Attributes

void * ptr = nullptr
 Pointer to allocated memory, nullptr on failure.
 
size_t allocated_size = 0
 Actual size allocated (may be larger than requested)
 

Detailed Description

Result type for allocation operations.

Contains pointer and actual allocated size, or error code.

Definition at line 32 of file allocator_traits.hpp.

Member Function Documentation

◆ Valid()

constexpr bool helios::memory::AllocationResult::Valid ( ) const
inlineconstexprnoexcept

Checks if the allocation was successful.

Returns
True if ptr is not nullptr, false otherwise
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_traits.hpp.

Definition at line 40 of file allocator_traits.hpp.

40{ return ptr != nullptr && allocated_size > 0; }
void * ptr
Pointer to allocated memory, nullptr on failure.
size_t allocated_size
Actual size allocated (may be larger than requested)

Member Data Documentation

◆ allocated_size

size_t helios::memory::AllocationResult::allocated_size = 0

Actual size allocated (may be larger than requested)

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_traits.hpp.

Definition at line 34 of file allocator_traits.hpp.

◆ ptr

void* helios::memory::AllocationResult::ptr = nullptr

Pointer to allocated memory, nullptr on failure.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/memory/allocator_traits.hpp.

Definition at line 33 of file allocator_traits.hpp.