Template Class pn532::esp32::capable_allocator

Class Documentation

template<class T>
class capable_allocator

An allocator class that wraps heap_caps_malloc, to add capabilities to the allocated memory. This can be used to allocate e.g. DMA-accessible memory (MALLOC_CAP_DMA).

Template Parameters:

T – Type to allocate

Comparison operators

Two allocators are said to be the same if and only if they have the same type and the same capabilities.

template<class U>
constexpr bool operator==(capable_allocator<U> const&) noexcept
template<class U>
constexpr bool operator!=(capable_allocator<U> const&) noexcept

Allocator interface

Methods to allocate and deallocate memory.

T *allocate(std::size_t n)
void deallocate(T *p, std::size_t n) noexcept

Public Types

using value_type = T

Public Functions

constexpr std::uint32_t capabilities() const
Returns:

The capabilities with which this allocator was constructed via capable_allocator(std::uint32_t).

constexpr capable_allocator() = default

Constructs a new allocator with capabilities set to 0.

explicit constexpr capable_allocator(std::uint32_t caps)

Construct a new allocator which passed caps to heap_caps_malloc.

Parameters:

caps – Any combination of the MALLOC_CAP_* defines from esp_heap_caps.h.

template<class U>
explicit constexpr capable_allocator(capable_allocator<U> const &other) noexcept

Copies or converts the allocator to a different type, inheriting the same capabilities.

Template Parameters:

U – Another allocator type

Parameters:

other – Another allocator.

template<class T>
constexpr capable_allocator(uint32_t caps)