alloc/chunked: remove local fwd decl for std::pmr::memory_resource
This commit is contained in:
parent
92dda992ee
commit
161f84ef53
@ -8,48 +8,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if 0 && __has_include(<memory_resource>)
|
||||
#include <memory_resource>
|
||||
#else
|
||||
#include <cstddef>
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace std::pmr {
|
||||
class memory_resource {
|
||||
public:
|
||||
memory_resource () = default;
|
||||
memory_resource (memory_resource const&) = default;
|
||||
memory_resource& operator= (memory_resource const&) = default;
|
||||
virtual ~memory_resource () = default;
|
||||
|
||||
[[nodiscard]] void* allocate (
|
||||
std::size_t bytes,
|
||||
std::size_t alignment = alignof (std::max_align_t)
|
||||
) { return do_allocate (bytes, alignment); }
|
||||
|
||||
void deallocate(
|
||||
void* p,
|
||||
std::size_t bytes,
|
||||
std::size_t alignment = alignof(std::max_align_t)
|
||||
) { return do_deallocate (p, bytes, alignment); }
|
||||
|
||||
bool is_equal (memory_resource const &rhs) const noexcept
|
||||
{
|
||||
return do_is_equal (rhs);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void *do_allocate (std::size_t bytes, std::size_t alignment) = 0;
|
||||
virtual void do_deallocate (void *p, std::size_t bytes, std::size_t alignment) = 0;
|
||||
virtual bool do_is_equal (memory_resource const&) const noexcept = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace cruft::alloc {
|
||||
/// An unbounded contiguous allocator that operates on chunks, similar to
|
||||
|
Loading…
Reference in New Issue
Block a user