Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::base::AllocUnorderedMap< Key, Value, Hash, Pred > Class Template Reference

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

#include "allocunorderedmap.h"

Inheritance diagram for ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >:
Collaboration diagram for ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >:

Public Types

typedef std::pair< const Key,
Value
PairType
 
typedef StlAllocator< PairTypeAllocType
 
typedef std::unordered_map
< Key, Value, Hash, Pred,
AllocType
MapType
 

Public Member Functions

 AllocUnorderedMap (const AllocatorPtr &alloc)
 
 AllocUnorderedMap (const Allocatable &owner)
 
template<typename ContainerT >
 AllocUnorderedMap (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 >
 AllocUnorderedMap (const Allocatable &owner, const ContainerT &from)
 

Public Attributes

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

Detailed Description

template<typename Key, typename Value, typename Hash = ::std::hash<Key>, typename Pred = ::std::equal_to<Key>>
class ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >

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

AllocUnorderedMap<int, float> local_map(allocator);

AllocUnorderedMap 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: AllocUnorderedMap<int, float> member_map_; };

Definition at line 53 of file allocunorderedmap.h.

Member Typedef Documentation

template<typename Key, typename Value, typename Hash = ::std::hash<Key>, typename Pred = ::std::equal_to<Key>>
typedef StlAllocator<PairType> ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >::AllocType

Definition at line 57 of file allocunorderedmap.h.

template<typename Key, typename Value, typename Hash = ::std::hash<Key>, typename Pred = ::std::equal_to<Key>>
typedef std::unordered_map<Key, Value, Hash, Pred, AllocType> ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >::MapType

Definition at line 58 of file allocunorderedmap.h.

template<typename Key, typename Value, typename Hash = ::std::hash<Key>, typename Pred = ::std::equal_to<Key>>
typedef std::pair<const Key, Value> ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >::PairType

Definition at line 56 of file allocunorderedmap.h.

Constructor & Destructor Documentation

template<typename Key, typename Value, typename Hash = ::std::hash<Key>, typename Pred = ::std::equal_to<Key>>
ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >::AllocUnorderedMap ( const AllocatorPtr alloc)
inlineexplicit

Definition at line 60 of file allocunorderedmap.h.

template<typename Key, typename Value, typename Hash = ::std::hash<Key>, typename Pred = ::std::equal_to<Key>>
ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >::AllocUnorderedMap ( const Allocatable owner)
inlineexplicit

Definition at line 63 of file allocunorderedmap.h.

template<typename Key, typename Value, typename Hash = ::std::hash<Key>, typename Pred = ::std::equal_to<Key>>
template<typename ContainerT >
ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >::AllocUnorderedMap ( 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 70 of file allocunorderedmap.h.

template<typename Key, typename Value, typename Hash = ::std::hash<Key>, typename Pred = ::std::equal_to<Key>>
template<typename ContainerT >
ion::base::AllocUnorderedMap< Key, Value, Hash, Pred >::AllocUnorderedMap ( const Allocatable owner,
const ContainerT &  from 
)
inline

Definition at line 74 of file allocunorderedmap.h.

Member Data Documentation

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

STL member.

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

STL member.


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