33#ifndef DART_COMMON_DETAIL_MEMORYMANAGER_IMPL_HPP_
34#define DART_COMMON_DETAIL_MEMORYMANAGER_IMPL_HPP_
41template <
typename T,
typename... Args>
45 void*
object = allocate(
type,
sizeof(T));
54 new (object) T(std::forward<Args>(args)...);
58 deallocate(
type,
object,
sizeof(T));
62 return reinterpret_cast<T*
>(object);
66template <
typename T,
typename... Args>
69 return construct<T, Args...>(Type::Free, std::forward<Args>(args)...);
73template <
typename T,
typename... Args>
76 return construct<T, Args...>(Type::Pool, std::forward<Args>(args)...);
88 deallocate(
type,
object,
sizeof(T));
95 destroy(Type::Free, pointer);
102 destroy(Type::Pool, pointer);
std::string type
Definition SdfParser.cpp:82
T * constructUsingPool(Args &&... args) noexcept
Allocates uninitialized storage using PoolAllocator and constructs an object of type T to the allocat...
Definition MemoryManager-impl.hpp:74
void destroyUsingPool(T *pointer) noexcept
Calls the destructor of the object and deallocate the storage using PoolAllocator.
Definition MemoryManager-impl.hpp:100
T * construct(Type type, Args &&... args) noexcept
Allocates uninitialized storage and constructs an object of type T to the allocated storage.
Definition MemoryManager-impl.hpp:42
Type
Type of the memory allocators.
Definition MemoryManager.hpp:53
void destroy(Type type, T *object) noexcept
Calls the destructor of the object and deallocate the storage.
Definition MemoryManager-impl.hpp:81
void destroyUsingFree(T *pointer) noexcept
Calls the destructor of the object and deallocate the storage using FreeListAllocator.
Definition MemoryManager-impl.hpp:93
T * constructUsingFree(Args &&... args) noexcept
Allocates uninitialized storage using FreeListAllocator and constructs an object of type T to the all...
Definition MemoryManager-impl.hpp:67