blob: d59575aef503eb57fb25d2fe5622eb226914e0e1 (
plain) (
blame)
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
|
#pragma once
#include <memory>
template <class Allocator, class T>
using TReboundAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<T>;
class IAllocator {
public:
struct TBlock {
void* Data;
size_t Len;
};
virtual ~IAllocator() = default;
virtual TBlock Allocate(size_t len) = 0;
virtual void Release(const TBlock& block) = 0;
};
class TDefaultAllocator: public IAllocator {
public:
TBlock Allocate(size_t len) override;
void Release(const TBlock& block) override;
static IAllocator* Instance() noexcept;
};
|