aboutsummaryrefslogtreecommitdiff
path: root/src/DI/allocation.hpp
blob: ac0fa382cccdcf18e010e49baaa8804484776ee0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include <memory>

template <class Traits, class Type>
struct RebindAllocHelper
{
	using type = typename Traits::template rebind_alloc<Type>;
};

template <class Allocator>
class AllocDestructor
{
	using _alloc_traits = std::allocator_traits<Allocator>;

public:
	using Pointer = typename _alloc_traits::pointer;
	using Size = typename _alloc_traits::size_type;

	using pointer = Pointer;
	using size = Size;

	AllocDestructor(Allocator &allocator, Size alloc_size) noexcept;

	void operator()(Pointer ptr) noexcept;

private:
	Allocator &_allocator;
	Size _size;
};

#include "allocation.tpp"