WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
wpi::memory::memory_resource_allocator Class Reference

Wraps a memory_resource and makes it a RawAllocator. More...

#include <wpi/memory/memory_resource_adapter.hpp>

Public Member Functions

 memory_resource_allocator (memory_resource *ptr) noexcept
 
void * allocate_node (std::size_t size, std::size_t alignment)
 
void deallocate_node (void *ptr, std::size_t size, std::size_t alignment) noexcept
 
std::size_t max_alignment () const noexcept
 
memory_resourceresource () const noexcept
 

Detailed Description

Wraps a memory_resource and makes it a RawAllocator.

Constructor & Destructor Documentation

◆ memory_resource_allocator()

wpi::memory::memory_resource_allocator::memory_resource_allocator ( memory_resource * ptr)
inlinenoexcept
Effects:
Creates it by giving it a pointer to the memory_resource.
Requires:
ptr must not be nullptr.

Member Function Documentation

◆ allocate_node()

void * wpi::memory::memory_resource_allocator::allocate_node ( std::size_t size,
std::size_t alignment )
inline
Effects:
Allocates a node by forwarding to the allocate() function.
Returns:
The node as returned by the memory_resource.
Throws:
Anything thrown by the allocate() function.

◆ deallocate_node()

void wpi::memory::memory_resource_allocator::deallocate_node ( void * ptr,
std::size_t size,
std::size_t alignment )
inlinenoexcept
Effects:
Deallocates a node by forwarding to the deallocate() function.

◆ max_alignment()

std::size_t wpi::memory::memory_resource_allocator::max_alignment ( ) const
inlinenoexcept
Returns:
The maximum alignment which is the maximum value of type std::size_t.

◆ resource()

memory_resource * wpi::memory::memory_resource_allocator::resource ( ) const
inlinenoexcept
Returns:
A pointer to the used memory_resource, this is never nullptr.

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