3#ifndef TETL_MEMORY_MONOTONIC_ALLOCATOR_HPP
4#define TETL_MEMORY_MONOTONIC_ALLOCATOR_HPP
26 if (
etl::align(
alignof(T),
sizeof(T) * n, _ptr, _sz) !=
nullptr) {
27 auto* result =
reinterpret_cast<T*
>(_ptr);
28 _ptr =
reinterpret_cast<char*
>(_ptr) +
sizeof(T) * n;
39 void* _ptr{_memory.
data()};
Definition adjacent_find.hpp:8
auto align(etl::size_t alignment, etl::size_t size, void *&ptr, etl::size_t &space) noexcept -> void *
Given a pointer ptr to a buffer of size space, returns a pointer aligned by the specified alignment f...
Definition align.hpp:22
TETL_BUILTIN_PTRDIFF ptrdiff_t
etl::ptrdiff_t is the signed integer type of the result of subtracting two pointers.
Definition ptrdiff_t.hpp:14
constexpr auto ignore_unused(Types &&...) -> void
Explicitly ignore arguments or variables.
Definition ignore_unused.hpp:17
TETL_BUILTIN_SIZET size_t
etl::size_t is the unsigned integer type of the result of the sizeof operator.
Definition size_t.hpp:14
etl::ptrdiff_t difference_type
Definition monotonic_allocator.hpp:17
etl::size_t size_type
Definition monotonic_allocator.hpp:16
auto deallocate(T *p, etl::size_t n) -> void
Definition monotonic_allocator.hpp:35
monotonic_allocator(etl::span< etl::byte > memory)
Definition monotonic_allocator.hpp:19
auto allocate(etl::size_t n) -> T *
Definition monotonic_allocator.hpp:24
T value_type
Definition monotonic_allocator.hpp:15
A non-owning view over a contiguous sequence of objects.
Definition span.hpp:83
constexpr auto data() const noexcept -> pointer
Returns a pointer to the beginning of the sequence.
Definition span.hpp:214
constexpr auto size() const noexcept -> size_type
Returns the number of elements in the span.
Definition span.hpp:217