siplasplas
A library for C++ reflection and introspection
cpp::DeadPoolStorage< PreallocatedSize, PreallocatedAlignment > Class Template Reference

Implements fixed-size with fallback to dynamic allocation. More...

#include <siplasplas/typeerasure/anystorage/deadpool.hpp>

Public Member Functions

void * storage (cpp::typeerasure::TypeInfo typeInfo) const
 
template<typename T >
constexpr bool objectFitsInStorage () const
 
std::size_t dynamicAllocStorageSize () const
 

Detailed Description

template<std::size_t PreallocatedSize, std::size_t PreallocatedAlignment = alignof(std::uint8_t)>
class cpp::DeadPoolStorage< PreallocatedSize, PreallocatedAlignment >

Implements fixed-size with fallback to dynamic allocation.

DeadPoolStorage implements a fixed-size storage similar to FixedSizeStorage but that switches to dynamic allocation if there's no enough space in the fixed-size storage to allocate the object

Dynamic allocation is performed through cpp::detail::aligned_malloc()

Template Parameters
PreAllocatedSizeMax capacity of the storage
PreAllocatedAlignmentStorage alignment. Alignof(std::uint8_t) by default

The documentation for this class was generated from the following file: