siplasplas
freelist_allocator.hpp
1 #ifndef SIPLASPLAS_ALLOCATOR_FREELIST_ALLOCATOR_HPP
2 #define SIPLASPLAS_ALLOCATOR_FREELIST_ALLOCATOR_HPP
3 
4 #include <string>
5 
6 #include "detail/embedded_allocator.hpp"
7 #include <siplasplas/allocator/export.hpp>
8 
9 namespace cpp
10 {
11  class SIPLASPLAS_ALLOCATOR_EXPORT FreeListAllocator : public EmbeddedAllocator
12  {
13  public:
14  struct FreeListNode
15  {
16  FreeListNode* next;
17  };
18 
20 
21  FreeListAllocator(void* begin, void* end, std::size_t block_length, std::size_t alignment, std::size_t offset = 0);
22 
23  void* allocate(std::size_t size, std::size_t alignment, std::size_t offset = 0);
24  void deallocate(void* pointer, std::size_t size, std::size_t offset = 0);
25 
26  std::string dump() const;
27 
28  private:
30  };
31 }
32 
33 #endif // SIPLASPLAS_ALLOCATOR_FREELIST_ALLOCATOR_HPP
Definition: messaging.hpp:8
constexpr auto end(const Sequence &sequence)
Returns an iterator pointing to the end of a sequence.
Definition: algorithm.hpp:86
constexpr auto begin(const Sequence &sequence)
Returns an iterator pointing to the beginning of a sequence.
Definition: algorithm.hpp:62
Definition: freelist_allocator.hpp:11
Definition: embedded_allocator.hpp:10
Definition: memory_manip.hpp:410
Definition: freelist_allocator.hpp:14