30 #ifndef BIT_MEMORY_BLOCK_ALLOCATORS_POLICY_BLOCK_ALLOCATOR_HPP 31 #define BIT_MEMORY_BLOCK_ALLOCATORS_POLICY_BLOCK_ALLOCATOR_HPP 33 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 35 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 37 #include "../utilities/ebo_storage.hpp" 38 #include "../utilities/allocator_info.hpp" 39 #include "../utilities/memory_block.hpp" 40 #include "../utilities/owner.hpp" 42 #include "../concepts/BlockAllocator.hpp" 44 #include "../traits/block_allocator_traits.hpp" 59 template<
typename BlockAllocator,
60 bool HasAlignment = block_allocator_has_default_block_alignment<BlockAllocator>::value>
61 struct policy_block_allocator_base
66 template<
typename BlockAllocator>
67 struct policy_block_allocator_base<BlockAllocator,true>
69 using default_block_alignment =
typename BlockAllocator::default_block_alignment;
97 template<
typename BlockAllocator,
98 typename MemoryTagger,
99 typename MemoryTracker,
100 typename BasicLockable>
102 :
private ebo_storage<BlockAllocator,MemoryTagger,MemoryTracker,BasicLockable>,
103 public detail::policy_block_allocator_base<BlockAllocator>
116 using lock_type = BasicLockable;
117 using tracker_type = MemoryTracker;
131 template<
typename Arg0,
typename...Args,
132 typename = std::enable_if_t<
133 std::is_constructible<BlockAllocator,Arg0,Args...>::value &&
134 !std::is_same<Arg0,std::decay_t<policy_block_allocator>>::value>>
143 policy_block_allocator( policy_block_allocator&& other ) =
default;
151 policy_block_allocator(
const policy_block_allocator& other ) =
default;
157 ~policy_block_allocator();
168 policy_block_allocator& operator=( policy_block_allocator&& other ) =
default;
177 policy_block_allocator& operator=(
const policy_block_allocator& other ) =
default;
187 owner<memory_block> allocate_block();
192 void deallocate_block( owner<memory_block> block );
202 const tracker_type& tracker()
const noexcept;
216 std::size_t next_block_size()
const noexcept;
222 #include "detail/policy_block_allocator.inl" The block_allocator_traits class template provides a standardized way to access block allocator funct...
This block allocator uses policies to modify the behaviour of the underlying type.
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...