libcaramel
global_resource.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
12 
13 namespace caramel
14 {
19  {
20  public:
21  using pointer = typename memory_resource::pointer;
22  using const_pointer = typename memory_resource::const_pointer;
23 
24  public:
36  auto allocate(count_t bytes, align_t alignment) noexcept -> pointer override;
47  void deallocate(gsl::not_null<pointer> ptr, count_t bytes,
48  align_t alignment) noexcept override;
56  auto is_equal(const memory_resource& other) const noexcept -> bool override;
57  };
58 } // namespace caramel
Simple allocator for global allocations.
Definition: global_resource.hpp:19
auto allocate(count_t bytes, align_t alignment) noexcept -> pointer override
Pure virtual function for a common allocation interface.
Definition: global_resource.cpp:5
void deallocate(gsl::not_null< pointer > ptr, count_t bytes, align_t alignment) noexcept override
Pure virtual function for a common deallocation interface.
Definition: global_resource.cpp:14
auto is_equal(const memory_resource &other) const noexcept -> bool override
Pure virtual function for a common comparison interface.
Definition: global_resource.cpp:23
Abstract class defining the interface of a memory resource.
Definition: memory_resource.hpp:23
void * pointer
alias for ease of naming
Definition: memory_resource.hpp:25
const void * const_pointer
alias for ease of naming
Definition: memory_resource.hpp:26
Definition: strong_type.hpp:12