52#ifndef ATLALLOCATORS_ARENAPOOLSTLALLOCATOR
53#define ATLALLOCATORS_ARENAPOOLSTLALLOCATOR
87 const std::string& name =
"");
104template <
class T,
class VETO=T>
154 template <
class U,
class V>
216 template <
bool = true>
217 requires (!std::same_as<reference,const_reference>)
252 template <class...
Args>
362template <class T, class VETO>
364 : public
std::allocator<T*>
367 typedef std::allocator<T*>
base;
396 template <
class U,
class V>
413 const std::string&
name()
const;
447 typename
std::enable_if<!std::is_pointer_v<T>, T>
::type>
448 :
public std::allocator<T>
451 typedef std::allocator<T>
base;
480 template <
class U,
class V>
497 const std::string&
name()
const;
517 template <
class CONT>
551 template <
class U,
class V>
630template <
class T,
class VETO>
Pool-based allocator. See Arena.h for an overview of the arena-based memory allocators.
Define macros for attributes used to control the static checker.
Common base class for arena allocator classes.
Common functionality for block-oriented allocators.
ArenaNonConstPoolSTLAllocator(const ArenaPoolSTLAllocator< U, V > &a, ArenaBlockAllocatorBase *poolptr_nc)
Constructor.
void erase()
Free all allocated elements and release memory back to the system.
void unprotect()
Write-enable the memory managed by this allocator.
ArenaBlockAllocatorBase * m_poolptr_nc
Non-const pointer to the underlying allocator.
void reset()
Free all allocated elements.
void reserve(size_t size)
Set the total number of elements cached by the allocator.
void protect()
Write-protect the memory managed by this allocator.
size_t nblock() const
Return the hinted number of objects allocated per block.
ArenaPoolSTLAllocator(const ArenaPoolSTLAllocator< U, V > &a)
Constructor from another ArenaPoolSTLAllocator.
ArenaAllocatorBase::Stats stats() const
Return the statistics block for this allocator.
ArenaPoolSTLAllocator(size_t nblock=1000, const std::string &name="")
Default constructor.
const ArenaBlockAllocatorBase * m_poolptr
Point at an underlying allocator from a different specialization.
static ArenaNonConstPoolSTLAllocator< T > get_allocator(CONT &c)
Return an allocator supporting non-const methods from a non-const container reference.
const std::string & name() const
Return the name of this allocator.
base::size_type size_type
size_t m_nblock
Saved hinted number of objects per block.
base::difference_type difference_type
const ArenaBlockAllocatorBase * poolptr() const
Return a pointer to the underlying allocator (may be 0).
base::value_type value_type
Standard STL allocator typedefs.
std::string m_name
Saved allocator name.
std::allocator< T * > base
ArenaPoolSTLAllocator(size_t nblock=1000, const std::string &name="")
Default constructor.
const std::string & name() const
Return the name of this allocator.
base::size_type size_type
size_t nblock() const
Return the hinted number of objects allocated per block.
ArenaPoolSTLAllocator(const ArenaPoolSTLAllocator< U, V > &a)
Constructor from another ArenaPoolSTLAllocator.
base::value_type value_type
Standard STL allocator typedefs.
base::difference_type difference_type
ArenaAllocatorBase::initParams< T, false, true, true > Base
We take defaults from this.
ArenaAllocatorBase::Params params() const
Return an initialized parameters structure.
ArenaPoolSTLAllocator_initParams(size_t nblock=1000, const std::string &name="")
Constructor.
STL-style allocator wrapper for ArenaPoolAllocator.
ArenaPoolSTLAllocator select_on_container_copy_construction() const
Return allocator to use for a copy-constructed container.
bool operator==(const ArenaPoolSTLAllocator &other) const
Equality test.
void construct(pointer p, Args &&... args)
ArenaPoolSTLAllocator(const ArenaPoolSTLAllocator &a)
Copy constructor.
ArenaPoolSTLAllocator(size_t nblock=1000, const std::string &name="")
Default constructor.
pointer address(reference x) const
Convert a reference to an address.
pointer allocate(size_type n, const void *hint=0)
Allocate new objects.
ArenaPoolAllocator m_pool
ArenaPoolSTLAllocator(ArenaPoolSTLAllocator &&a)
Move constructor.
bool operator!=(const ArenaPoolSTLAllocator &other) const
Inequality test.
T * pointer
Standard STL allocator typedefs.
const T & const_reference
size_type max_size() const
Return the maximum number of objects we can allocate at once.
ptrdiff_t difference_type
void swap(ArenaPoolSTLAllocator &a)
Swap.
const ArenaBlockAllocatorBase * poolptr() const
std::true_type propagate_on_container_swap
std::true_type propagate_on_container_move_assignment
Move allocators on move/swap.
ArenaPoolSTLAllocator(const ArenaPoolSTLAllocator< U, V > &a)
Constructor from another ArenaPoolSTLAllocator.
const std::string & name() const
ArenaPoolSTLAllocator & operator=(ArenaPoolSTLAllocator &&a)
Move assignment.
void reserve(size_t size)
void deallocate(pointer, size_type n)
Deallocate objects.
ArenaAllocatorBase::Stats stats() const
std::false_type propagate_on_container_copy_assignment
When we assign to a container, the target should retain its allocator.
void maybeUnprotect(ArenaHeapSTLAllocator< T, VETO > &a)
Hook for unprotecting an arena.
Statistics for an allocator.
Helper to initialize a parameters structure.
Standard STL allocator rebinder.
ArenaPoolSTLAllocator< U, VETO > other
Standard STL allocator rebinder.
ArenaPoolSTLAllocator< U, T > other
Standard STL allocator rebinder.
ArenaPoolSTLAllocator< U, VETO > other