30 #ifndef BIT_MEMORY_BLOCK_ALLOCATORS_NEW_BLOCK_ALLOCATOR_HPP 31 #define BIT_MEMORY_BLOCK_ALLOCATORS_NEW_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/ebo_storage.hpp" 42 #include "../utilities/dynamic_size_type.hpp" 43 #include "../utilities/allocator_info.hpp" 44 #include "../utilities/macros.hpp" 45 #include "../utilities/memory_block.hpp" 46 #include "../utilities/owner.hpp" 48 #include "../policies/growth_multipliers/no_growth.hpp" 51 #include <type_traits> 65 template<std::size_t DefaultBlockSize,
66 typename GrowthMultiplier=no_growth_multiplier>
79 using default_block_alignment = std::integral_constant<std::size_t,alignof(std::max_align_t)>;
98 template<std::size_t USize=DefaultBlockSize,
99 typename=std::enable_if_t<USize!=dynamic_size>>
109 template<std::size_t USize=DefaultBlockSize,
110 typename=std::enable_if_t<USize==dynamic_size>>
112 GrowthMultiplier growth = GrowthMultiplier{} );
130 new_block_allocator&
operator=( new_block_allocator&& other ) =
default;
136 new_block_allocator&
operator=(
const new_block_allocator& other ) =
default;
176 template<std::
size_t DefaultBlockSize,
typename GrowthMultiplier=no_growth_multiplier>
177 using cached_new_block_allocator
178 = detail::cached_block_allocator<new_block_allocator<DefaultBlockSize,GrowthMultiplier>>;
182 template<std::
size_t DefaultBlockSize,
typename GrowthMultiplier=no_growth_multiplier>
183 using named_new_block_allocator
184 = detail::named_block_allocator<new_block_allocator<DefaultBlockSize,GrowthMultiplier>>;
188 template<std::
size_t DefaultBlockSize,
typename GrowthMultiplier=no_growth_multiplier>
189 using named_cached_new_block_allocator
190 = detail::named_block_allocator<cached_new_block_allocator<DefaultBlockSize,GrowthMultiplier>>;
195 #include "detail/new_block_allocator.inl" This type is used as a compile-time constant for storing size values.
void deallocate_block(owner< memory_block > block) noexcept
Deallocates a new'ed memory_block.
allocator_info info() const noexcept
Gets the info about this allocator.
new_block_allocator() noexcept=default
Default-constructs this new_block_allocator.
new_block_allocator & operator=(new_block_allocator &&other)=default
Move-assigns a new_block_allocator from another allocator.
A block allocator that wraps around calls to new and delete.
owner< memory_block > allocate_block() noexcept
Allocates a new'ed memory_block.
std::size_t next_block_size() const noexcept
Queries the next block size expected from this allocator.
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...