9 #ifndef CPPSERVER_ASIO_MEMORY_H
10 #define CPPSERVER_ASIO_MEMORY_H
53 std::
byte _storage[1024];
98 { _storage = alloc._storage;
return *
this; }
100 { _storage = alloc._storage;
return *
this; }
131 template <
typename THandler>
155 template <
typename ...Args>
156 void operator()(Args&&... args) { _handler(std::forward<Args>(args)...); }
168 template <
typename THandler>
Asio allocate handler wrapper.
AllocateHandler(const AllocateHandler &) noexcept=default
HandlerAllocator< THandler > allocator_type
Allocator type.
AllocateHandler(HandlerStorage &storage, THandler handler) noexcept
Initialize allocate handler wrapper with a given memory storage and handler.
void operator()(Args &&... args)
Wrap the handler.
AllocateHandler(AllocateHandler &&) noexcept=default
size_t size_type
Quantities of elements.
HandlerAllocator & operator=(const HandlerAllocator &alloc) noexcept
HandlerAllocator(HandlerStorage &storage) noexcept
Initialize allocator with a given memory storage.
T & reference
Reference to element.
HandlerAllocator(const HandlerAllocator< U > &alloc) noexcept
HandlerAllocator(HandlerAllocator &&) noexcept=default
HandlerAllocator(const HandlerAllocator &alloc) noexcept
ptrdiff_t difference_type
Difference between two pointers.
const T * const_pointer
Pointer to constant element.
void deallocate(pointer ptr, size_type num)
Release a block of storage previously allocated.
HandlerAllocator & operator=(HandlerAllocator &&) noexcept=default
const T & const_reference
Reference to constant element.
T value_type
Element type.
T * pointer
Pointer to element.
void deallocate(void *ptr)
Deallocate memory buffer.
HandlerStorage(HandlerStorage &&)=delete
HandlerStorage() noexcept
HandlerStorage(const HandlerStorage &)=delete
~HandlerStorage() noexcept=default
void * allocate(size_t size)
Allocate memory buffer.
Asio memory manager inline implementation.
AllocateHandler< THandler > make_alloc_handler(HandlerStorage &storage, THandler handler)
Helper function to wrap a handler object to add custom allocation.
C++ Server project definitions.