const_container/include/allocator.h

31 lines
576 B
C
Raw Permalink Normal View History

2024-01-22 14:25:39 +01:00
//
// Created by Patrick Maschek on 22.01.2024.
//
#ifndef UDIFF_ALLOCATOR_H_
#define UDIFF_ALLOCATOR_H_
#include <exception>
#include <cstddef>
namespace cc {
template<typename T>
2024-01-22 22:43:06 +01:00
class allocator_base {
2024-01-22 14:25:39 +01:00
public:
using value_type = T;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
2024-01-22 22:43:06 +01:00
[[nodiscard]] virtual constexpr T* allocate(size_type size) = 0;
2024-01-22 14:25:39 +01:00
2024-01-22 22:43:06 +01:00
virtual constexpr void deallocate(T*, size_type) = 0;
2024-01-22 14:25:39 +01:00
2024-01-22 22:43:06 +01:00
[[nodiscard]] size_type max_size() = 0;
2024-01-22 14:25:39 +01:00
};
2024-01-22 22:43:06 +01:00
using statically_allocated = void;
2024-01-22 14:25:39 +01:00
}
#endif //UDIFF_ALLOCATOR_H_