template<typename T, std::size_t BlockSize = 32>
FastPoolAllocator class
Fast pool allocator for small objects.
| Template parameters | |
|---|---|
| T | Type to allocate |
| BlockSize | Number of objects per block |
Uses boost::pool for efficient allocation/deallocation of small, fixed-size objects.
Public types
- struct pool_tag
-
template<typename U>struct rebind
- using value_type = T
- using pointer = T*
- using const_pointer = const T*
- using reference = T&
- using const_reference = const T&
- using size_type = std::size_t
- using difference_type = std::ptrdiff_t
-
using pool_type = boost::singleton_pool<pool_
tag, sizeof(T), boost::default_user_allocator_new_delete, boost::details::pool::null_mutex, BlockSize>
Public static functions
- static auto get_allocated_count() -> std::size_t
- static void release_memory()
- static void purge_memory()
Constructors, destructors, conversion operators
- FastPoolAllocator() defaulted noexcept
- FastPoolAllocator(const FastPoolAllocator&) defaulted noexcept
-
template<typename U>FastPoolAllocator(const FastPoolAllocator<U, BlockSize>&) noexcept
- ~FastPoolAllocator() defaulted
Public functions
-
auto allocate(size_
type n) -> pointer -
void deallocate(pointer p,
size_
type n) noexcept -
template<typename U, typename... Args>void construct(U* p, Args && ... args)
-
template<typename U>void destroy(U* p) noexcept
- auto operator==(const FastPoolAllocator&) const -> bool noexcept
- auto operator!=(const FastPoolAllocator&) const -> bool noexcept