34 #ifndef __STL_POOLED_ALLOC 35 #define __STL_POOLED_ALLOC 86 pointer
allocate(size_type count, std::allocator<void>::const_pointer = 0)
const {
87 if (count == 1 &&
m_pool) {
90 return reinterpret_cast<T*
>(
new char[count *
sizeof(
T)] );
99 void deallocate(pointer block, size_type count)
const throw() {
104 assert(block &&
"null pointer argument");
105 if (count == 1 &&
m_pool) {
108 delete[]
reinterpret_cast<char*
>( block );
133 const_pointer
address(const_reference element)
const {
171 template<
typename T,
typename U>
177 template<
typename T,
typename U>
188 template<
typename Key,
typename Value,
class Traits = std::less<Key>>
190 typedef std::map<Key, Value, Traits, PooledAllocator<std::pair<Key, Value>>>
Type;
194 template<
typename Key,
typename Value,
class Traits = std::less<Key>>
196 typedef std::multimap<Key, Value, Traits, PooledAllocator<std::pair<Key, Value>>>
Type;
200 template<
typename Value>
202 typedef std::list<Value, PooledAllocator<Value>>
Type;
206 template<
typename Value,
typename Traits = std::less<Value>>
208 typedef std::set<Value, Traits, PooledAllocator<Value>>
Type;
212 template<
typename Value>
214 typedef std::vector<Value, PooledAllocator<Value>>
Type;
217 #endif // __STL_POOLED_ALLOC std::map< Key, Value, Traits, PooledAllocator< std::pair< Key, Value > > > Type
Definition: stl_pooled_alloc.h:190
Simple pool class.
Definition: stl_pool.h:40
PooledAllocator< U > other
Definition: stl_pooled_alloc.h:60
PooledAllocator()
Creates a pooled allocator with no pool.
Definition: stl_pooled_alloc.h:161
Pool * m_pool
The pool for this allocator.
Definition: stl_pooled_alloc.h:167
void const * const_pointer
Pointer to const void.
Definition: stl_pooled_alloc.h:150
PooledAllocator(Pool *pool)
Creates a pooled allocator to the given pool.
Definition: stl_pooled_alloc.h:164
bool operator==(PooledAllocator< T > const &left, PooledAllocator< U > const &right)
Returns true if objects allocated from one pool can be deallocated from the other.
Definition: stl_pooled_alloc.h:172
Template typedef std::map<..., PooledAllocator> to PooledMap<Key, Value>::Type.
Definition: stl_pooled_alloc.h:189
Template typedef std::vector<..., PooledAllocator> to PooledVec<Value>::Type.
Definition: stl_pooled_alloc.h:213
T & reference
Reference to T.
Definition: stl_pooled_alloc.h:54
std::set< Value, Traits, PooledAllocator< Value > > Type
Definition: stl_pooled_alloc.h:208
size_type max_size() const
The largest value that can meaningfully passed to allocate.
Definition: stl_pooled_alloc.h:79
A struct to construct an allocator for a different type.
Definition: stl_pooled_alloc.h:59
void * pointer
Pointer to void;.
Definition: stl_pooled_alloc.h:149
Template typedef std::multimap<..., PooledAllocator> to PooledMultiMap<Key, Value>::Type.
Definition: stl_pooled_alloc.h:195
ptrdiff_t difference_type
A type that can represent the difference between any two pointers in the allocation model...
Definition: stl_pooled_alloc.h:49
pointer allocate(size_type count, std::allocator< void >::const_pointer=0) const
Memory is allocated for count objects of type T but objects are not constructed.
Definition: stl_pooled_alloc.h:86
Template typedef std::set<..., PooledAllocator> to PooledSet<Value>::Type.
Definition: stl_pooled_alloc.h:207
void deallocate(pointer block, size_type count) const
Deallocates memory allocated by allocate.
Definition: stl_pooled_alloc.h:99
A standards-compliant pooled allocator.
Definition: stl_pooled_alloc.h:46
T * pointer
Pointer to T;.
Definition: stl_pooled_alloc.h:52
PooledAllocator(PooledAllocator< U > const &arg)
Creates a pooled allocator to the argument's pool.
Definition: stl_pooled_alloc.h:74
PooledAllocator(Pool *pool=0)
Creates a pooled allocator to the given pool.
Definition: stl_pooled_alloc.h:66
const_pointer address(const_reference element) const
Returns the address of the given reference.
Definition: stl_pooled_alloc.h:133
PooledAllocator< U > other
Definition: stl_pooled_alloc.h:155
void construct(pointer element, T const &arg)
Constructs an element of T at the given pointer.
Definition: stl_pooled_alloc.h:115
size_t GetGranularity() const
Gets the pool granularity.
Definition: stl_pool.h:49
size_t size_type
A type that can represent the size of the largest object in the allocation model. ...
Definition: stl_pooled_alloc.h:145
size_t size_type
A type that can represent the size of the largest object in the allocation model. ...
Definition: stl_pooled_alloc.h:48
pointer address(reference element) const
Returns the address of the given reference.
Definition: stl_pooled_alloc.h:128
T const & const_reference
Reference to const T.
Definition: stl_pooled_alloc.h:55
ptrdiff_t difference_type
A type that can represent the difference between any two pointers in the allocation model...
Definition: stl_pooled_alloc.h:146
void value_type
Identical to void.
Definition: stl_pooled_alloc.h:148
void destroy(pointer element)
Destroys an element of T at the given pointer.
Definition: stl_pooled_alloc.h:122
Template typedef std::list<..., PooledAllocator> to PooledList<Value>::Type.
Definition: stl_pooled_alloc.h:201
void * Allocate()
Allocates memory from the pool without construction.
Definition: stl_pool.cpp:64
std::vector< Value, PooledAllocator< Value > > Type
Definition: stl_pooled_alloc.h:214
T const * const_pointer
Pointer to const T.
Definition: stl_pooled_alloc.h:53
bool operator!=(PooledAllocator< T > const &left, PooledAllocator< U > const &right)
Returns true if objects allocated from one pool cannot be deallocated from the other.
Definition: stl_pooled_alloc.h:178
Pool * m_pool
The pool for this allocator.
Definition: stl_pooled_alloc.h:138
T value_type
Identical to T.
Definition: stl_pooled_alloc.h:51
#define T
Definition: w_okvl_inl.h:45
std::list< Value, PooledAllocator< Value > > Type
Definition: stl_pooled_alloc.h:202
void Deallocate(void *block)
Deallocates memory from the pool without destruction.
Definition: stl_pool.cpp:74
std::multimap< Key, Value, Traits, PooledAllocator< std::pair< Key, Value > > > Type
Definition: stl_pooled_alloc.h:196