WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
wpi::memory::memory_resource_adapter< RawAllocator > Class Template Reference

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

#include <wpi/memory/memory_resource_adapter.hpp>

Inheritance diagram for wpi::memory::memory_resource_adapter< RawAllocator >:
wpi::memory::memory_resource

Public Types

using allocator_type = typename allocator_traits<RawAllocator>::allocator_type
 

Public Member Functions

 memory_resource_adapter (allocator_type &&other) noexcept
 
allocator_typeget_allocator () noexcept
 
const allocator_typeget_allocator () const noexcept
 

Protected Types

using traits_type = allocator_traits<RawAllocator>
 

Protected Member Functions

void * do_allocate (std::size_t bytes, std::size_t alignment) override
 
void do_deallocate (void *p, std::size_t bytes, std::size_t alignment) override
 
bool do_is_equal (const memory_resource &other) const noexcept override
 

Detailed Description

template<class RawAllocator>
class wpi::memory::memory_resource_adapter< RawAllocator >

Wraps a RawAllocator and makes it a memory_resource.

Member Typedef Documentation

◆ allocator_type

template<class RawAllocator >
using wpi::memory::memory_resource_adapter< RawAllocator >::allocator_type = typename allocator_traits<RawAllocator>::allocator_type

◆ traits_type

template<class RawAllocator >
using wpi::memory::memory_resource_adapter< RawAllocator >::traits_type = allocator_traits<RawAllocator>
protected

Constructor & Destructor Documentation

◆ memory_resource_adapter()

template<class RawAllocator >
wpi::memory::memory_resource_adapter< RawAllocator >::memory_resource_adapter ( allocator_type && other)
inlinenoexcept
Effects:
Creates the resource by moving in the allocator.

Member Function Documentation

◆ do_allocate()

template<class RawAllocator >
void * wpi::memory::memory_resource_adapter< RawAllocator >::do_allocate ( std::size_t bytes,
std::size_t alignment )
inlineoverrideprotected
Effects:
Allocates raw memory with given size and alignment. It forwards to allocate_node() or allocate_array() depending on the size.
Returns:
The new memory as returned by the RawAllocator.
Throws:
Anything thrown by the allocation function.

◆ do_deallocate()

template<class RawAllocator >
void wpi::memory::memory_resource_adapter< RawAllocator >::do_deallocate ( void * p,
std::size_t bytes,
std::size_t alignment )
inlineoverrideprotected
Effects:
Deallocates memory previously allocated by do_allocate. It forwards to deallocate_node() or deallocate_array() depending on the size.
Throws:
Nothing.

◆ do_is_equal()

template<class RawAllocator >
bool wpi::memory::memory_resource_adapter< RawAllocator >::do_is_equal ( const memory_resource & other) const
inlineoverrideprotectednoexcept
Returns:
Whether or not *this is equal to other by comparing the addresses.

◆ get_allocator() [1/2]

template<class RawAllocator >
const allocator_type & wpi::memory::memory_resource_adapter< RawAllocator >::get_allocator ( ) const
inlinenoexcept

◆ get_allocator() [2/2]

template<class RawAllocator >
allocator_type & wpi::memory::memory_resource_adapter< RawAllocator >::get_allocator ( )
inlinenoexcept
Returns:
A reference to the wrapped allocator.

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