KTL
Loading...
Searching...
No Matches
mallocator.h
Go to the documentation of this file.
1#pragma once
2
3#include "../utility/aligned_malloc.h"
4#include "../utility/alignment.h"
5#include "mallocator_fwd.h"
6#include "type_allocator.h"
7
8namespace ktl
9{
16 {
17 public:
18 mallocator() noexcept = default;
19
20 mallocator(const mallocator&) noexcept = default;
21
22 mallocator(mallocator&&) noexcept = default;
23
24 mallocator& operator=(const mallocator&) noexcept = default;
25
26 mallocator& operator=(mallocator&&) noexcept = default;
27
28 bool operator==(const mallocator& rhs) const noexcept
29 {
30 return true;
31 }
32
33 bool operator!=(const mallocator& rhs) const noexcept
34 {
35 return false;
36 }
37
38#pragma region Allocation
39 void* allocate(size_t n) noexcept
40 {
42 }
43
44 void deallocate(void* p, size_t n) noexcept
45 {
47 }
48#pragma endregion
49 };
50}
An allocator which uses an aligned malloc for allocation.
Definition mallocator.h:16
void deallocate(void *p, size_t n) noexcept
Definition mallocator.h:44
void * allocate(size_t n) noexcept
Definition mallocator.h:39
bool operator!=(const mallocator &rhs) const noexcept
Definition mallocator.h:33
mallocator() noexcept=default
void * aligned_malloc(size_t size, size_t alignment) noexcept
Definition aligned_malloc.h:48
void aligned_free(void *ptr) noexcept
Definition aligned_malloc.h:73
constexpr size_t ALIGNMENT
Definition alignment.h:7
Definition cascading.h:16