28#ifndef OZZ_OZZ_BASE_MEMORY_ALLOCATOR_H_
29#define OZZ_OZZ_BASE_MEMORY_ALLOCATOR_H_
35#include "ozz/base/platform.h"
44OZZ_BASE_DLL Allocator* default_allocator();
48OZZ_BASE_DLL Allocator* SetDefaulAllocator(Allocator* _allocator);
65 virtual void* Allocate(
size_t _size,
size_t _alignment) = 0;
70 virtual void Deallocate(
void* _block) = 0;
80template <
typename _Ty,
typename... _Args>
81_Ty* New(_Args&&... _args) {
83 memory::default_allocator()->Allocate(
sizeof(_Ty),
alignof(_Ty));
84 return new (alloc) _Ty(std::forward<_Args>(_args)...);
87template <
typename _Ty>
88void Delete(_Ty* _object) {
94 memory::default_allocator()->Deallocate(_object);
Definition allocator.h:55