12 return m_numUsedBytes;
22 return m_blockSizeInBytes;
27 return m_blocks.size();
35 static_assert(std::is_trivially_destructible_v<T>);
38 return reinterpret_cast<T*
>(
allocRaw(
sizeof(T),
alignof(T)));
46 static_assert(std::is_trivially_destructible_v<T>);
49 T*
const storage =
reinterpret_cast<T*
>(
allocRaw(
sizeof(T) * arraySize,
alignof(T)));
54template<
typename T,
typename... Args>
57 if constexpr(std::is_trivially_destructible_v<T>)
59 return std::construct_at(
alloc<T>(), std::forward<Args>(args)...);
63 T*
const objPtr = std::construct_at(
64 reinterpret_cast<T*
>(
allocRaw(
sizeof(T),
alignof(T))),
65 std::forward<Args>(args)...);
68 m_dtorCallers.push_back(
std::size_t numAllocatedBytes() const
Definition MemoryArena.ipp:15
TSpan< T > allocArray(const std::size_t arraySize)
Allocate raw memory for array of type T. Convenient method for allocating raw memory for array of typ...
Definition MemoryArena.ipp:42
T * alloc()
Allocate raw memory for type T. Convenient method for allocating raw memory for object of type T....
Definition MemoryArena.ipp:31
std::size_t numUsedBytes() const
Definition MemoryArena.ipp:10
std::size_t getBlockSizeInBytes() const
Definition MemoryArena.ipp:20
std::size_t numAllocatedBlocks() const
Definition MemoryArena.ipp:25
std::byte * allocRaw(std::size_t numBytes, std::size_t alignmentInBytes=alignof(std::max_align_t))
Allocate raw memory. Generally speaking, the memory returned contains no object–placement new is requ...
Definition MemoryArena.cpp:78
T * make(Args &&... args)
Make an object of type T. Convenient method for creating an object without needing a placement new la...
Definition MemoryArena.ipp:55
The root for all renderer implementations.
Definition EEngineProject.h:6
std::span< T, EXTENT > TSpan
A contiguous sequence of objects of type T. Effectively the same as std::span.
Definition TSpan.h:12