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

This class can be used in place of std::vector to allow an Ion Allocator to be used for memory allocation. More...

#include "allocvector.h"

Inheritance diagram for ion::base::AllocVector< T >:
Collaboration diagram for ion::base::AllocVector< T >:

Public Types

typedef StlAllocator< TAllocType
 
typedef std::vector< T, AllocTypeVectorType
 

Public Member Functions

 AllocVector (const AllocatorPtr &alloc)
 
 AllocVector (const Allocatable &owner)
 
 AllocVector (const AllocatorPtr &alloc, size_t n, const T &val)
 
 AllocVector (const Allocatable &owner, size_t n, const T &val)
 
template<class IteratorT >
 AllocVector (const AllocatorPtr &alloc, IteratorT first, IteratorT last)
 
template<class IteratorT >
 AllocVector (const Allocatable &owner, IteratorT first, IteratorT last)
 
template<typename ContainerT >
 AllocVector (const AllocatorPtr &alloc, const ContainerT &from)
 These constructors can be used to copy from "STL iterables": anything that provides a pair of compatible iterators via begin() and end(). More...
 
template<typename ContainerT >
 AllocVector (const Allocatable &owner, const ContainerT &from)
 
 AllocVector (const AllocatorPtr &alloc, std::initializer_list< T > init)
 These constructors allow AllocVector to be initialized using c++11's list initialization: AllocVector<int> vector(allocator, {1, 2, 3, 4});. More...
 
 AllocVector (const Allocatable &owner, std::initializer_list< T > init)
 

Public Attributes

T elements
 STL member. More...
 

Detailed Description

template<typename T>
class ion::base::AllocVector< T >

This class can be used in place of std::vector to allow an Ion Allocator to be used for memory allocation.

There is a constructor that takes the Allocator to be used as an argument. For example:

AllocVector<int> vec(allocator);

AllocVector also provides a convenience constructor to declare class members of a derived Allocatable class. It uses the same Allocator that was used for the Allocatable. For example:

class MyClass : public Allocatable { public: ///< The vector will use the same Allocator as the MyClass instance. MyClass() : member_vec_(*this) {} ... private: AllocVector<int> member_vec_; };

Definition at line 50 of file allocvector.h.

Member Typedef Documentation

template<typename T>
typedef StlAllocator<T> ion::base::AllocVector< T >::AllocType

Definition at line 52 of file allocvector.h.

template<typename T>
typedef std::vector<T, AllocType> ion::base::AllocVector< T >::VectorType

Definition at line 53 of file allocvector.h.

Constructor & Destructor Documentation

template<typename T>
ion::base::AllocVector< T >::AllocVector ( const AllocatorPtr alloc)
inlineexplicit

Definition at line 54 of file allocvector.h.

template<typename T>
ion::base::AllocVector< T >::AllocVector ( const Allocatable owner)
inlineexplicit

Definition at line 56 of file allocvector.h.

template<typename T>
ion::base::AllocVector< T >::AllocVector ( const AllocatorPtr alloc,
size_t  n,
const T val 
)
inline

Definition at line 59 of file allocvector.h.

template<typename T>
ion::base::AllocVector< T >::AllocVector ( const Allocatable owner,
size_t  n,
const T val 
)
inline

Definition at line 62 of file allocvector.h.

template<typename T>
template<class IteratorT >
ion::base::AllocVector< T >::AllocVector ( const AllocatorPtr alloc,
IteratorT  first,
IteratorT  last 
)
inline

Definition at line 66 of file allocvector.h.

template<typename T>
template<class IteratorT >
ion::base::AllocVector< T >::AllocVector ( const Allocatable owner,
IteratorT  first,
IteratorT  last 
)
inline

Definition at line 70 of file allocvector.h.

template<typename T>
template<typename ContainerT >
ion::base::AllocVector< T >::AllocVector ( const AllocatorPtr alloc,
const ContainerT &  from 
)
inline

These constructors can be used to copy from "STL iterables": anything that provides a pair of compatible iterators via begin() and end().

Definition at line 77 of file allocvector.h.

template<typename T>
template<typename ContainerT >
ion::base::AllocVector< T >::AllocVector ( const Allocatable owner,
const ContainerT &  from 
)
inline

Definition at line 81 of file allocvector.h.

template<typename T>
ion::base::AllocVector< T >::AllocVector ( const AllocatorPtr alloc,
std::initializer_list< T init 
)
inline

These constructors allow AllocVector to be initialized using c++11's list initialization: AllocVector<int> vector(allocator, {1, 2, 3, 4});.

Definition at line 88 of file allocvector.h.

template<typename T>
ion::base::AllocVector< T >::AllocVector ( const Allocatable owner,
std::initializer_list< T init 
)
inline

Definition at line 91 of file allocvector.h.

Member Data Documentation

T std::vector< T >::elements
inherited

STL member.


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