ATLAS Offline Software
|
STL-style allocator wrapper for ArenaHeapAllocator
.
More...
#include "AthAllocators/ArenaHeapAllocator.h"
#include "CxxUtils/concepts.h"
#include "CxxUtils/checker_macros.h"
#include <string>
#include <cstddef>
#include "AthAllocators/ArenaHeapSTLAllocator.icc"
Go to the source code of this file.
Classes | |
class | SG::ArenaHeapSTLAllocator_initParams< T > |
Initializer for pool allocator parameters. More... | |
class | SG::ArenaHeapSTLAllocator< T, VETO > |
STL-style allocator wrapper for ArenaHeapAllocator . More... | |
struct | SG::ArenaHeapSTLAllocator< T, VETO >::rebind< U > |
Standard STL allocator rebinder. More... | |
class | SG::ArenaNonConstHeapSTLAllocator< T > |
Forward declaration. More... | |
class | SG::ArenaHeapSTLAllocator< T, T > |
STL-style allocator wrapper for ArenaHeapAllocator . More... | |
struct | SG::ArenaHeapSTLAllocator< T, T >::rebind< U > |
Standard STL allocator rebinder. More... | |
class | SG::ArenaNonConstHeapSTLAllocator< T > |
Forward declaration. More... | |
Namespaces | |
SG | |
Forward declaration. | |
Functions | |
template<class T , class VETO > | |
void | SG::maybeUnprotect (ArenaHeapSTLAllocator< T, VETO > &a) |
Hook for unprotecting an arena. More... | |
STL-style allocator wrapper for ArenaHeapAllocator
.
T
with the following special properties.ArenaHeapAllocator
for allocations.So, this allocator is suitable for an STL container which allocates lots of fixed-size objects, such as std::list
.
Much of the complexity here is due to the fact that the allocator type that gets passed to the container is an allocator for the container's value_type, but that allocator is not actually used to allocate memory. Instead, an allocator for the internal node type is used. This makes it awkward if you want to have allocators that store state.
Further, to avoid creating a pool for the allocator for the container's value_type (when the container doesn't actually use that for allocation), this template has a second argument. This defaults to the first argument, but is passed through by rebind. If the first and second argument are the same, then we don't create a pool.
The effect of all this is that you can give an allocator type like ArenaHeapSTLAllocator<Mytype> to a STL container. Allocators for Mytype won't use a pool, but an allocator for node<Mytype> will use the pool.
Definition in file ArenaHeapSTLAllocator.h.