diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-04-05 00:00:33 +0200 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-04-05 00:00:33 +0200 |
commit | f46b019cb0a2f451234fdb4f20620b7e443da136 (patch) | |
tree | 29a3b0f1441cef9932e0770b155294be55d11e9e /deimos/core/allocator.cpp | |
parent | 8970c40ce9a9a4e5f582b48f69b77bd90d8e678e (diff) |
Add gsl::owner
Diffstat (limited to 'deimos/core/allocator.cpp')
-rw-r--r-- | deimos/core/allocator.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/deimos/core/allocator.cpp b/deimos/core/allocator.cpp index 1a823c1..b42861c 100644 --- a/deimos/core/allocator.cpp +++ b/deimos/core/allocator.cpp @@ -8,8 +8,8 @@ namespace deimos class SystemAllocatorImpl : public IAllocator
{
public:
- void* Reallocate(
- void* old_ptr, int64_t /* old_size */, int64_t new_size,
+ gsl::owner<void*> Reallocate(
+ gsl::owner<void*> old_ptr, int64_t /* old_size */, int64_t new_size,
MemoryScope /* scope */, const SourceLocation& /* source_location */) override
{
if (old_ptr == nullptr)
@@ -44,13 +44,15 @@ public: system = &m_system;
}
- Allocator* CreateChild(Allocator* parent, gsl::czstring /* description */) override
+ gsl::owner<Allocator*> CreateChild(Allocator* parent, gsl::czstring /* description */) override
{
- return parent;
+ return parent->New<Allocator>(parent->allocator(), MemoryScope{});
}
- void DestroyChild(Allocator*) override
+ void DestroyChild(gsl::owner<Allocator*> allocator) override
{
+ deimos_StaticAssert(std::is_trivially_destructible_v<Allocator>);
+ allocator->Delete(allocator);
}
};
|