Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::base::StlInlinedAllocator< T, N > Class Template Reference

StlInlinedAllocator is a derived StlAllocator class that uses inlined storage for its first N elements, then uses an Ion Allocator if that size is exceeded. More...

#include "stlallocator.h"

Inheritance diagram for ion::base::StlInlinedAllocator< T, N >:
Collaboration diagram for ion::base::StlInlinedAllocator< T, N >:

Classes

struct  rebind
 
struct  RebindHelper
 Windows uses transient proxy allocators. More...
 
struct  RebindHelper< U, U >
 Specialize for when the types are the same, that is, for the primary T allocator. More...
 

Public Types

typedef StlAllocator< T >::Pointer Pointer
 
typedef StlAllocator< T >
::ConstPointer 
ConstPointer
 
typedef StlAllocator< T >::SizeType 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

 StlInlinedAllocator (const AllocatorPtr &allocator)
 
 StlInlinedAllocator (const StlInlinedAllocator< T, N > &a)
 Copy constructor. More...
 
template<typename U >
 StlInlinedAllocator (const StlInlinedAllocator< U, N > &a)
 This copy constructor cannot be explicit because older versions of STL seem to implicitly cast between allocators of different types. More...
 
Pointer allocate (SizeType n, ConstPointer hint=0)
 
void deallocate (Pointer p, SizeType n)
 
const AllocatorPtrGetAllocator () const
 Returns the Allocator used by this. More...
 
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 , int M>
class StlInlinedAllocator
 

Detailed Description

template<typename T, int N>
class ion::base::StlInlinedAllocator< T, N >

StlInlinedAllocator is a derived StlAllocator class that uses inlined storage for its first N elements, then uses an Ion Allocator if that size is exceeded.

Definition at line 157 of file stlallocator.h.

Member Typedef Documentation

template<typename T, int N>
typedef StlAllocator<T>::ConstPointer ion::base::StlInlinedAllocator< T, N >::ConstPointer

Definition at line 160 of file stlallocator.h.

template<typename T, int N>
typedef StlAllocator<T>::Pointer ion::base::StlInlinedAllocator< T, N >::Pointer

Definition at line 159 of file stlallocator.h.

template<typename T>
typedef std::true_type ion::base::StlAllocator< T >::propagate_on_container_move_assignment
inherited

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.

template<typename T>
typedef std::true_type ion::base::StlAllocator< T >::propagate_on_container_swap
inherited

Definition at line 45 of file stlallocator.h.

template<typename T, int N>
typedef StlAllocator<T>::SizeType ion::base::StlInlinedAllocator< T, N >::SizeType

Definition at line 161 of file stlallocator.h.

Constructor & Destructor Documentation

template<typename T, int N>
ion::base::StlInlinedAllocator< T, N >::StlInlinedAllocator ( const AllocatorPtr allocator)
inlineexplicit

Definition at line 162 of file stlallocator.h.

template<typename T, int N>
ion::base::StlInlinedAllocator< T, N >::StlInlinedAllocator ( const StlInlinedAllocator< T, N > &  a)
inlineexplicit

Copy constructor.

This needs to be explicitly listed so that inlined storage is not copied.

Definition at line 166 of file stlallocator.h.

template<typename T, int N>
template<typename U >
ion::base::StlInlinedAllocator< T, N >::StlInlinedAllocator ( const StlInlinedAllocator< U, N > &  a)
inline

This copy constructor cannot be explicit because older versions of STL seem to implicitly cast between allocators of different types.

Definition at line 173 of file stlallocator.h.

Member Function Documentation

template<typename T, int N>
Pointer ion::base::StlInlinedAllocator< T, N >::allocate ( SizeType  n,
ConstPointer  hint = 0 
)
inline

Definition at line 177 of file stlallocator.h.

References ion::base::StlAllocator< T >::allocate().

template<typename T>
void ion::base::StlAllocator< T >::construct ( Pointer  p,
const T val 
)
inlineinherited

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.

References type, and value.

template<typename T>
template<typename... Args>
void ion::base::StlAllocator< T >::construct ( Pointer  p,
Args &&...  args 
)
inlineinherited

Definition at line 84 of file stlallocator.h.

References type, and value.

template<typename T>
template<class U , class... Args>
void ion::base::StlAllocator< T >::construct ( U *  p,
Args &&...  args 
)
inlineinherited

Definition at line 95 of file stlallocator.h.

References type, and value.

template<typename T, int N>
void ion::base::StlInlinedAllocator< T, N >::deallocate ( Pointer  p,
SizeType  n 
)
inline

Definition at line 191 of file stlallocator.h.

References ion::base::StlAllocator< T >::deallocate().

template<typename T>
const AllocatorPtr& ion::base::StlAllocator< T >::GetAllocator ( ) const
inlineinherited

Returns the Allocator used by this.

Definition at line 54 of file stlallocator.h.

Referenced by ion::base::operator!=(), and ion::base::operator==().

Friends And Related Function Documentation

template<typename T, int N>
template<typename U , int M>
friend class StlInlinedAllocator
friend

Definition at line 230 of file stlallocator.h.

Member Data Documentation

T std::allocator< T >::elements
inherited

STL member.


The documentation for this class was generated from the following file: