const_container/include/allocator.h

33 lines
619 B
C++

//
// 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>
class allocator {
public:
using value_type = T;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
[[nodiscard]] virtual constexpr T* allocate(size_type size) {
throw std::bad_alloc();
}
virtual constexpr void deallocate(T*, size_type) {}
[[nodiscard]] size_type max_size() { return 0; }
};
using statically_allocated = allocator<void>;
}
#endif //UDIFF_ALLOCATOR_H_