diff options
author | HampusM <hampus@hampusmat.com> | 2022-04-10 17:20:49 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:58 +0200 |
commit | b36d072ad7a7b9c6e30fcb25d6bbb001a8393468 (patch) | |
tree | 7749fc877652bb2cf7bbd2b7c1fed5e3abe397fc /src/DI/allocation.tpp | |
parent | b828d4799a84beb1afbd889e5c4cb939a8b3df78 (diff) |
refactor: add factory class & make DI container return unique ptrs
Diffstat (limited to 'src/DI/allocation.tpp')
-rw-r--r-- | src/DI/allocation.tpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/DI/allocation.tpp b/src/DI/allocation.tpp new file mode 100644 index 0000000..245ce99 --- /dev/null +++ b/src/DI/allocation.tpp @@ -0,0 +1,16 @@ +#pragma once + +#include "allocation.hpp" + +template <class Allocator> +AllocDestructor<Allocator>::AllocDestructor(Allocator &allocator, + Size alloc_size) noexcept + : _allocator(allocator), _size(alloc_size) +{ +} + +template <class Allocator> +void AllocDestructor<Allocator>::operator()(Pointer ptr) noexcept +{ + _alloc_traits::deallocate(_allocator, ptr, _size); +} |