Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
allocdeque.h
Go to the documentation of this file.
1 
18 #ifndef ION_BASE_STLALLOC_ALLOCDEQUE_H_
19 #define ION_BASE_STLALLOC_ALLOCDEQUE_H_
20 
21 #include <deque>
22 
23 #include "ion/base/allocatable.h"
26 
27 namespace ion {
28 namespace base {
29 
48 
49 template <typename T>
50 class AllocDeque : public std::deque<T, StlAllocator<T> > {
51  public:
53  typedef std::deque<T, AllocType> DequeType;
54  explicit AllocDeque(const AllocatorPtr& alloc)
55  : DequeType(AllocType(AllocationManager::GetNonNullAllocator(alloc))) {}
56  explicit AllocDeque(const Allocatable& owner)
57  : DequeType(AllocType(owner.GetNonNullAllocator())) {}
58 
61  template <typename ContainerT>
62  AllocDeque(const AllocatorPtr& alloc, const ContainerT& from)
63  : DequeType(from.begin(), from.end(),
64  AllocType(AllocationManager::GetNonNullAllocator(alloc))) {}
65  template <typename ContainerT>
66  AllocDeque(const Allocatable& owner, const ContainerT& from)
67  : DequeType(from.begin(), from.end(),
68  AllocType(owner.GetNonNullAllocator())) {}
69 };
70 
71 } // namespace base
72 } // namespace ion
73 
74 #endif // ION_BASE_STLALLOC_ALLOCDEQUE_H_
StlAllocator is derived std::allocator class that allows an Ion Allocator to be used for STL containe...
Definition: stlallocator.h:35
AllocDeque(const Allocatable &owner, const ContainerT &from)
Definition: allocdeque.h:66
StlAllocator< T > AllocType
Definition: allocdeque.h:52
AllocationManager is a singleton class that is used to manage Allocators used to allocate Ion objects...
AllocDeque(const Allocatable &owner)
Definition: allocdeque.h:56
std::deque< T, AllocType > DequeType
Definition: allocdeque.h:53
Allocatable is an abstract base class for classes whose memory is managed by an Allocator.
Definition: allocatable.h:60
This class can be used in place of std::deque to allow an Ion Allocator to be used for memory allocat...
Definition: allocdeque.h:50
AllocDeque(const AllocatorPtr &alloc, const ContainerT &from)
These constructors can be used to copy from "STL iterables": anything that provides a pair of compati...
Definition: allocdeque.h:62
AllocDeque(const AllocatorPtr &alloc)
Definition: allocdeque.h:54