![]() |
ATLAS Offline Software
|
STL-style allocator wrapper for ArenaPoolAllocator
.
More...
#include <ArenaPoolSTLAllocator.h>
Classes | |
struct | rebind |
Standard STL allocator rebinder. More... | |
Public Types | |
typedef std::allocator< T > | base |
typedef base::value_type | value_type |
Standard STL allocator typedefs. More... | |
typedef base::size_type | size_type |
typedef base::difference_type | difference_type |
Public Member Functions | |
ArenaPoolSTLAllocator (size_t nblock=1000, const std::string &name="") | |
Default constructor. More... | |
template<class U , class V > | |
ArenaPoolSTLAllocator (const ArenaPoolSTLAllocator< U, V > &a) | |
Constructor from another ArenaPoolSTLAllocator . More... | |
size_t | nblock () const |
Return the hinted number of objects allocated per block. More... | |
const std::string & | name () const |
Return the name of this allocator. More... | |
ArenaAllocatorBase::Stats | stats () const |
Return the statistics block for this allocator. More... | |
const ArenaBlockAllocatorBase * | poolptr () const |
Return a pointer to the underlying allocator (may be 0). More... | |
Static Public Member Functions | |
template<class CONT > | |
static ArenaNonConstPoolSTLAllocator< T > | get_allocator (CONT &c) |
Return an allocator supporting non-const methods from a non-const container reference. More... | |
Public Attributes | |
T | elements |
STL member. More... | |
Private Attributes | |
size_t | m_nblock |
Saved hinted number of objects per block. More... | |
std::string | m_name |
Saved allocator name. More... | |
const ArenaBlockAllocatorBase * | m_poolptr |
Point at an underlying allocator from a different specialization. More... | |
STL-style allocator wrapper for ArenaPoolAllocator
.
This is the specialization for the case of the vetoed type.
We want to allow calling the non-const allocator methods reset(), erase(), and reserve() only if the corresponding container is non-const. However, we can't really do that, since the get_allocator() method of containers is only const, and returns an allocator by value. So instead, we split up this class. ArenaPoolSTLAllocator
holds a const pointer to the underlying allocator, and supports only the const methods on it. Then ArenaNonConstPoolSTLAllocator
derives from it and implements the non-const methods. To get an instance of the latter class, call ArenaPoolSTLAllocator::get_allocator(c), where is
the container — and must
be non-const.
See the file-level comments for further details.
Definition at line 445 of file ArenaPoolSTLAllocator.h.
typedef std::allocator<T> SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::base |
Definition at line 450 of file ArenaPoolSTLAllocator.h.
typedef base::difference_type SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::difference_type |
Definition at line 455 of file ArenaPoolSTLAllocator.h.
typedef base::size_type SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::size_type |
Definition at line 454 of file ArenaPoolSTLAllocator.h.
typedef base::value_type SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::value_type |
Standard STL allocator typedefs.
Definition at line 453 of file ArenaPoolSTLAllocator.h.
SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::ArenaPoolSTLAllocator | ( | size_t | nblock = 1000 , |
const std::string & | name = "" |
||
) |
SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::ArenaPoolSTLAllocator | ( | const ArenaPoolSTLAllocator< U, V > & | a | ) |
Constructor from another ArenaPoolSTLAllocator
.
The name
and nblock
parameters are copied, but the data are not.
|
static |
Return an allocator supporting non-const methods from a non-const container reference.
c | The (non-const) container. |
const std::string& SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::name | ( | ) | const |
Return the name of this allocator.
size_t SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::nblock | ( | ) | const |
Return the hinted number of objects allocated per block.
const ArenaBlockAllocatorBase* SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::poolptr | ( | ) | const |
Return a pointer to the underlying allocator (may be 0).
ArenaAllocatorBase::Stats SG::ArenaPoolSTLAllocator< T, typename std::enable_if<!std::is_pointer_v< T >, T >::type >::stats | ( | ) | const |
Return the statistics block for this allocator.
|
inherited |
STL member.
|
private |
Saved allocator name.
Definition at line 526 of file ArenaPoolSTLAllocator.h.
|
private |
Saved hinted number of objects per block.
Definition at line 523 of file ArenaPoolSTLAllocator.h.
|
private |
Point at an underlying allocator from a different specialization.
Definition at line 529 of file ArenaPoolSTLAllocator.h.