8#ifndef HPP_ALIB_MONOMEM_SELF_CONTAINED
9#define HPP_ALIB_MONOMEM_SELF_CONTAINED 1
11#if !defined(HPP_ALIB) && !defined(ALIB_DOX)
15#if !defined (HPP_ALIB_MONOMEM_MONOALLOCATOR)
19namespace alib {
namespace monomem {
82template<
typename TContained>
111 template<
typename... TArgs>
113 size_t initialChunkSize,
unsigned int chunkGrowthInPercent,
115 :
allocator( firstChunk, initialChunkSize, chunkGrowthInPercent )
116 ,
custom( std::forward<TArgs>(args)... )
144 template<
typename... TArgs>
145 SelfContained(
size_t initialChunkSize,
unsigned int chunkGrowthInPercent, TArgs&&... args )
148 "MONOMEM",
"Chunk size to small to create self-contained object." )
152 new (
fields)
Fields( firstChunk, initialChunkSize, chunkGrowthInPercent,
153 std::forward<TArgs>(args)... );
181 template<
typename... TArgs>
188 new (&
fields->
custom) TContained( std::forward<TArgs>(args)... );
209 this->fields= move.fields;
210 move .fields=
nullptr;
227 this->allocator = src.allocator;
228 src.allocator =
nullptr;
ALIB_API void Reset(const Snapshot &snapshot=Snapshot())
static constexpr size_t MaxUsableSpaceLoss()
SelfContained(size_t initialChunkSize, unsigned int chunkGrowthInPercent, TArgs &&... args)
SelfContained & operator=(SelfContained &)=delete
MonoAllocator & Allocator()
const MonoAllocator & Allocator() const
SelfContained(SelfContained &&move) noexcept
const TContained & Self() const
SelfContained(SelfContained &)=delete
void Reset(TArgs &&... args)
SelfContained & operator=(SelfContained &&src)
#define ALIB_ASSERT_ERROR(cond,...)
static ALIB_FORCE_INLINE void Destruct(T *object)
Fields(MonoAllocator::Chunk *firstChunk, size_t initialChunkSize, unsigned int chunkGrowthInPercent, TArgs &&... args)
MonoAllocator::Snapshot snapshot