emlabcpp
modern opinionated embedded C++ library
memory_resource.h
Go to the documentation of this file.
1 
24 #pragma once
25 
26 #include "../result.h"
27 
28 #include <cstddef>
29 
30 namespace emlabcpp::pmr
31 {
33 {
34 public:
35  [[nodiscard]] virtual void* allocate( std::size_t bytes, std::size_t alignment ) = 0;
36  [[nodiscard]] virtual result
37  deallocate( void* ptr, std::size_t bytes, std::size_t alignment ) = 0;
38  [[nodiscard]] virtual bool is_equal( memory_resource const& other ) const noexcept = 0;
39  [[nodiscard]] virtual bool is_full() const noexcept = 0;
40  virtual ~memory_resource() = default;
41 };
42 } // namespace emlabcpp::pmr
Definition: memory_resource.h:33
virtual void * allocate(std::size_t bytes, std::size_t alignment)=0
virtual result deallocate(void *ptr, std::size_t bytes, std::size_t alignment)=0
virtual bool is_full() const noexcept=0
virtual bool is_equal(memory_resource const &other) const noexcept=0
MIT License.
Definition: aliases.h:36
constexpr std::array< std::byte, N > bytes(Args const &... args)
Conveft the provided arguments into array of std::byte.
Definition: algorithm.h:524
result represents an result of some operation, as an alternative to returning just bool with true/fal...
Definition: result.h:42