Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::base::AllocMap< K, V, Compare > Class Template Reference

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

#include "allocmap.h"

Inheritance diagram for ion::base::AllocMap< K, V, Compare >:
Collaboration diagram for ion::base::AllocMap< K, V, Compare >:

Public Types

typedef std::pair< const K, VPairType
 
typedef StlAllocator< PairTypeAllocType
 
typedef std::map< K, V,
Compare, AllocType
MapType
 

Public Member Functions

 AllocMap (const AllocatorPtr &alloc)
 
 AllocMap (const Allocatable &owner)
 
template<typename ContainerT >
 AllocMap (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 >
 AllocMap (const Allocatable &owner, const ContainerT &from)
 
 AllocMap (const AllocatorPtr &alloc, std::initializer_list< PairType > init)
 These constructors allow AllocMap to be initialized using c++11's list initialization: AllocMap<int, float> map(allocator, { {1, 10.0f}, {2, 20.0f} });. More...
 
 AllocMap (const Allocatable &owner, std::initializer_list< PairType > init)
 

Public Attributes

keys
 STL member. More...
 
T elements
 STL member. More...
 

Detailed Description

template<typename K, typename V, typename Compare = std::less<K>>
class ion::base::AllocMap< K, V, Compare >

This class can be used in place of std::map 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:

AllocMap<int, float> local_map(allocator);

AllocMap 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 map will use the same Allocator as the MyClass instance. MyClass() : member_map_(*this) {} ... private: AllocMap<int, float> member_map_; };

Definition at line 50 of file allocmap.h.

Member Typedef Documentation

template<typename K, typename V, typename Compare = std::less<K>>
typedef StlAllocator<PairType> ion::base::AllocMap< K, V, Compare >::AllocType

Definition at line 54 of file allocmap.h.

template<typename K, typename V, typename Compare = std::less<K>>
typedef std::map<K, V, Compare, AllocType> ion::base::AllocMap< K, V, Compare >::MapType

Definition at line 55 of file allocmap.h.

template<typename K, typename V, typename Compare = std::less<K>>
typedef std::pair<const K, V> ion::base::AllocMap< K, V, Compare >::PairType

Definition at line 53 of file allocmap.h.

Constructor & Destructor Documentation

template<typename K, typename V, typename Compare = std::less<K>>
ion::base::AllocMap< K, V, Compare >::AllocMap ( const AllocatorPtr alloc)
inlineexplicit

Definition at line 56 of file allocmap.h.

template<typename K, typename V, typename Compare = std::less<K>>
ion::base::AllocMap< K, V, Compare >::AllocMap ( const Allocatable owner)
inlineexplicit

Definition at line 59 of file allocmap.h.

template<typename K, typename V, typename Compare = std::less<K>>
template<typename ContainerT >
ion::base::AllocMap< K, V, Compare >::AllocMap ( 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 65 of file allocmap.h.

template<typename K, typename V, typename Compare = std::less<K>>
template<typename ContainerT >
ion::base::AllocMap< K, V, Compare >::AllocMap ( const Allocatable owner,
const ContainerT &  from 
)
inline

Definition at line 69 of file allocmap.h.

template<typename K, typename V, typename Compare = std::less<K>>
ion::base::AllocMap< K, V, Compare >::AllocMap ( const AllocatorPtr alloc,
std::initializer_list< PairType init 
)
inline

These constructors allow AllocMap to be initialized using c++11's list initialization: AllocMap<int, float> map(allocator, { {1, 10.0f}, {2, 20.0f} });.

Definition at line 76 of file allocmap.h.

template<typename K, typename V, typename Compare = std::less<K>>
ion::base::AllocMap< K, V, Compare >::AllocMap ( const Allocatable owner,
std::initializer_list< PairType init 
)
inline

Definition at line 79 of file allocmap.h.

Member Data Documentation

T std::map< K, T >::elements
inherited

STL member.

K std::map< K, T >::keys
inherited

STL member.


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