ATLAS Offline Software
|
DataVector using a custom allocator for the elements. More...
#include "AthAllocators/ArenaHeapSTLAllocator.h"
#include "AthAllocators/maybeUnprotect.h"
#include "AthContainers/DataVector.h"
#include "AthContainers/DataVectorWithAllocFwd.h"
#include "AthenaKernel/ClassID_traits.h"
#include "AthContainers/DataVectorWithAlloc.icc"
Go to the source code of this file.
Namespaces | |
SG | |
Forward declaration. | |
Functions | |
template<class DV , class ALLOC > | |
void | swap (DataVectorWithAlloc< DV, ALLOC > &a, DataVectorWithAlloc< DV, ALLOC > &b) |
See DataVector<T, BASE>::swap() . More... | |
DataVector using a custom allocator for the elements.
The main difference in usage from an ordinary DataVector is that you need to allocate elements with the allocate() method, rather than using new. This will return a unique_ptr-like
type Ptr
, which should then be passed to the methods adding an element to the container
Similarly to ConstDataVector
, the DataVector
methods that take bare pointers are hidden via private inheritance, and the first template argument is the base DataVector type, or something deriving from it. A DataVectorWithAlloc<DV>
may be converted to a const DV
using asDataVector
, or by recording it in StoreGate. Once recorded, it may be retrieved as a const DV
, and it will also act as this for purposes of I/O.
It may be interesting to use the protect() methods of the AthAllocators classes to write-protect the contents of the vector. If that is done, the memory will automatically be unprotected when the vector is destroyed. For this to work, of course, the contents must be really immutable, not just const.
Definition in file DataVectorWithAlloc.h.
void swap | ( | DataVectorWithAlloc< DV, ALLOC > & | a, |
DataVectorWithAlloc< DV, ALLOC > & | b | ||
) |
See DataVector<T, BASE>::swap()
.
Definition at line 784 of file DataVectorWithAlloc.h.