Ion
|
StlAllocator is derived std::allocator class that allows an Ion Allocator to be used for STL containers. More...
#include "stlallocator.h"
Classes | |
struct | rebind |
Public Types | |
typedef std::allocator< T > ::pointer | Pointer |
typedef std::allocator< T > ::const_pointer | ConstPointer |
typedef std::allocator< T > ::size_type | SizeType |
typedef std::true_type | propagate_on_container_move_assignment |
These allocator traits affect the behavior of containers such as AllocVector. More... | |
typedef std::true_type | propagate_on_container_swap |
Public Member Functions | |
StlAllocator (const AllocatorPtr &allocator) | |
template<typename U > | |
StlAllocator (const StlAllocator< U > &a) | |
This copy constructor cannot be explicit because older versions of STL seem to implicitly cast between allocators of different types. More... | |
const AllocatorPtr & | GetAllocator () const |
Returns the Allocator used by this. More... | |
Pointer | allocate (SizeType n, ConstPointer hint=0) |
void | deallocate (Pointer p, SizeType n) |
void | construct (Pointer p, const T &val) |
Replace the construct() functions so that we can pass an Allocator to Allocatable types. More... | |
template<typename... Args> | |
void | construct (Pointer p, Args &&...args) |
template<class U , class... Args> | |
void | construct (U *p, Args &&...args) |
Public Attributes | |
T | elements |
STL member. More... | |
Friends | |
template<typename U > | |
class | StlAllocator |
StlAllocator is derived std::allocator class that allows an Ion Allocator to be used for STL containers.
There are derived container classes (such as AllocVector and AllocMap) that make it easier to use this allocator.
Definition at line 35 of file stlallocator.h.
typedef std::allocator<T>::const_pointer ion::base::StlAllocator< T >::ConstPointer |
Definition at line 38 of file stlallocator.h.
typedef std::allocator<T>::pointer ion::base::StlAllocator< T >::Pointer |
Definition at line 37 of file stlallocator.h.
typedef std::true_type ion::base::StlAllocator< T >::propagate_on_container_move_assignment |
These allocator traits affect the behavior of containers such as AllocVector.
During an assignment or swap, the StlAllocators will be swapped along with the container's memory.
Definition at line 44 of file stlallocator.h.
typedef std::true_type ion::base::StlAllocator< T >::propagate_on_container_swap |
Definition at line 45 of file stlallocator.h.
typedef std::allocator<T>::size_type ion::base::StlAllocator< T >::SizeType |
Definition at line 39 of file stlallocator.h.
|
inlineexplicit |
Definition at line 47 of file stlallocator.h.
|
inline |
This copy constructor cannot be explicit because older versions of STL seem to implicitly cast between allocators of different types.
Definition at line 51 of file stlallocator.h.
|
inline |
Definition at line 56 of file stlallocator.h.
References ion::base::Allocator::AllocateMemory(), DCHECK, and ion::base::SharedPtr< T >::Get().
Referenced by ion::base::StlInlinedAllocator< T, N >::allocate().
|
inline |
Replace the construct() functions so that we can pass an Allocator to Allocatable types.
The construct() functions inform the allocation system that there is a placement new allocation that might be an Allocatable. If the constructed type is trivially destructible, then construct() is forwarded to std::allocator, which just calls placement new(). Any non-trivially-destructible type that is default, copy, or move constructed, and thus might contain an Allocatable, will receive this container's Allocator.
Definition at line 73 of file stlallocator.h.
|
inline |
Definition at line 84 of file stlallocator.h.
|
inline |
Definition at line 95 of file stlallocator.h.
|
inline |
Definition at line 61 of file stlallocator.h.
References ion::base::Allocator::DeallocateMemory().
Referenced by ion::base::StlInlinedAllocator< T, N >::deallocate().
|
inline |
Returns the Allocator used by this.
Definition at line 54 of file stlallocator.h.
Referenced by ion::base::operator!=(), and ion::base::operator==().
Definition at line 150 of file stlallocator.h.