33 #ifndef BIT_MEMORY_TRAITS_BLOCK_ALLOCATOR_TRAITS_HPP 34 #define BIT_MEMORY_TRAITS_BLOCK_ALLOCATOR_TRAITS_HPP 36 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 38 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 40 #include "../utilities/allocator_info.hpp" 41 #include "../utilities/macros.hpp" 42 #include "../utilities/memory_block.hpp" 43 #include "../utilities/owner.hpp" 45 #include "../concepts/BlockAllocator.hpp" 47 #include <type_traits> 69 template<
typename BlockAllocator>
90 static owner<memory_block>
allocate_block( BlockAllocator& alloc );
97 owner<memory_block> block );
121 static std::size_t
next_block_size(
const BlockAllocator& alloc ) noexcept;
146 const BlockAllocator& alloc );
148 const BlockAllocator& alloc );
151 static std::size_t do_next_block_size( std::true_type,
152 const BlockAllocator& alloc );
153 static std::size_t do_next_block_size( std::false_type,
154 const BlockAllocator& alloc );
156 static std::size_t do_next_block_align_from_type( std::true_type,
157 const BlockAllocator& alloc );
158 static std::size_t do_next_block_align_from_type( std::false_type,
159 const BlockAllocator& alloc);
160 static std::size_t do_next_block_align_from_fn( std::true_type,
161 const BlockAllocator& alloc );
162 static std::size_t do_next_block_align_from_fn( std::false_type,
163 const BlockAllocator& alloc );
169 #include "detail/block_allocator_traits.inl" static std::size_t next_block_alignment(const BlockAllocator &alloc) noexcept
Gets the alignment of the next block from the block allocator.
static allocator_info info(const BlockAllocator &alloc) noexcept
Gets the name of the specified block allocator.
static std::size_t next_block_size(const BlockAllocator &alloc) noexcept
Gets the size of the next block from the block allocator.
Type-trait to determine whether T defines 'default_block_alignment'.
The block_allocator_traits class template provides a standardized way to access block allocator funct...
This type is used to hold the generic information for a given allocator.
static void deallocate_block(BlockAllocator &alloc, owner< memory_block > block)
Deallocates a block from the underlying container.
static owner< memory_block > allocate_block(BlockAllocator &alloc)
Allocates a block from the underlying allocator.
Type-trait to determine whether T satisfies the minimum requirements to be a BlockAllocator.