aboutsummaryrefslogtreecommitdiffstats
path: root/src/memory.hpp
blob: 0467bf637b18be01d07f397561dc58669ee8ab17 (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
33
34
35
36
37
38
#ifndef MEMORY_HPP
#define MEMORY_HPP

#include <cstddef>
#include <type_traits>

template<typename T>
struct kallocator
{
    using value_type = T;
    using size_type = std::size_t;
    using difference_type = std::ptrdiff_t;
    using propagate_on_container_move_assignment = std::true_type;
    using is_always_equal = std::true_type;

    template<class U>
    struct rebind {
        typedef kallocator<U> other;
    };

    kallocator() = default;

    template<typename U>
    kallocator(const kallocator<U>&) noexcept {}

    T* allocate(std::size_t n) {
        return new T[n];
    }

    void deallocate([[maybe_unused]] T* p, [[maybe_unused]] std::size_t n) {

    }
};

void memory_initialize();

#endif // MEMORY_HPP