30 #ifndef BIT_MEMORY_BLOCK_ALLOCATORS_ALIGNED_BLOCK_ALLOCATOR_HPP 31 #define BIT_MEMORY_BLOCK_ALLOCATORS_ALIGNED_BLOCK_ALLOCATOR_HPP 33 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 35 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 37 #include "detail/enum_types.hpp" 38 #include "detail/cached_block_allocator.hpp" 39 #include "detail/named_block_allocator.hpp" 41 #include "../utilities/allocator_info.hpp" 42 #include "../utilities/dynamic_size_type.hpp" 43 #include "../utilities/ebo_storage.hpp" 44 #include "../utilities/macros.hpp" 45 #include "../utilities/memory_block.hpp" 46 #include "../utilities/owner.hpp" 47 #include "../utilities/pointer_utilities.hpp" 49 #include "../policies/growth_multipliers/no_growth.hpp" 52 #include "../regions/aligned_heap_memory.hpp" 54 #include <type_traits> 78 template<std::size_t DefaultBlockSize,
79 std::size_t BlockAlign,
80 typename GrowthMultiplier=no_growth_multiplier>
90 static_assert( is_power_of_two(BlockAlign) || BlockAlign == dynamic_size,
91 "Alignment must be a power of two!" );
106 template<std::size_t USize=DefaultBlockSize,
107 std::size_t UAlign=BlockAlign,
108 typename=std::enable_if_t<(USize!=dynamic_block_size) &&
109 (UAlign!=dynamic_block_alignment)>>
117 template<std::size_t USize=DefaultBlockSize,
118 typename=std::enable_if_t<USize==dynamic_block_size>>
120 GrowthMultiplier growth = GrowthMultiplier{} );
127 template<std::size_t UAlign=BlockAlign,
128 typename=std::enable_if_t<UAlign==dynamic_block_alignment>>
130 GrowthMultiplier growth = GrowthMultiplier{} );
138 template<std::size_t USize=DefaultBlockSize,
139 std::size_t UAlign=BlockAlign,
140 typename=std::enable_if_t<(USize==dynamic_block_size) &&
141 (UAlign==dynamic_block_alignment)>>
143 block_alignment_t block_alignment,
144 GrowthMultiplier growth = GrowthMultiplier{} );
213 template<std::
size_t DefaultBlockSize,std::
size_t BlockAlign,
typename GrowthMultiplier=no_growth_multiplier>
214 using cached_aligned_block_allocator
215 = detail::cached_block_allocator<aligned_block_allocator<DefaultBlockSize,BlockAlign,GrowthMultiplier>>;
219 template<std::
size_t DefaultBlockSize,std::
size_t BlockAlign,
typename GrowthMultiplier=no_growth_multiplier>
220 using named_aligned_block_allocator
221 = detail::named_block_allocator<aligned_block_allocator<DefaultBlockSize,BlockAlign,GrowthMultiplier>>;
223 template<std::
size_t DefaultBlockSize,std::
size_t BlockAlign,
typename GrowthMultiplier=no_growth_multiplier>
224 using named_cached_aligned_block_allocator
225 = detail::named_block_allocator<cached_aligned_block_allocator<DefaultBlockSize,BlockAlign,GrowthMultiplier>>;
230 #include "detail/aligned_block_allocator.inl" This type is used as a compile-time constant for storing size values.
aligned_block_allocator & operator=(aligned_block_allocator &&other)=default
Move-assigns an aligned_block_allocator from another allocator.
std::size_t next_block_size() const noexcept
Queries the next block size expected from this allocator.
An allocator that allocates over-aligned memory.
owner< memory_block > allocate_block() noexcept
Allocates a memory_block of size block_size with alignment Align.
allocator_info info() const noexcept
Gets the info about this allocator.
aligned_block_allocator()=default
Constructs a aligned_block_allocator that will distribute blocks of the specified size...
void deallocate_block(owner< memory_block > block) noexcept
Deallocates a given memory_block.
This type is used to hold the generic information for a given allocator.
A utility class used for leveraging empty-base optimization for a generic sequence of types...