memory
Member Functions
joint_allocator Class Reference

Detailed Description

A RawAllocator that uses the additional joint memory for its allocation.

It is somewhat limited and allows only allocation once. All joint allocators for an object share the joint memory and must not be used in multiple threads. The memory it returns is owned by a joint_ptr and will be destroyed through it.

Member Functions

template<typename T >
 joint_allocator (joint_type< T > &j) noexcept
 
 joint_allocator (const joint_allocator &other) noexcept=default
 
joint_allocatoroperator= (const joint_allocator &other) noexcept=default
 
void * allocate_node (std::size_t size, std::size_t alignment)
 
void deallocate_node (void *ptr, std::size_t size, std::size_t) noexcept
 

Constructors

◆ joint_allocator()

joint_allocator ( joint_type< T > &  j)
noexcept
Effects:
Creates it using the joint memory of the given object.

Member Functions

◆ allocate_node()

void * allocate_node ( std::size_t  size,
std::size_t  alignment 
)
Effects:
Allocates a node with given properties.
Returns:
A pointer to the new node.
Throws:
out_of_fixed_memory exception if this function has been called for a second time or the joint memory block is exhausted.

◆ deallocate_node()

void deallocate_node ( void *  ptr,
std::size_t  size,
std::size_t   
)
noexcept
Effects:
Deallocates the node, if possible.
Note
It is only possible if it was the last allocation.