You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#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
|
|
|
|
|