117 typedef T value_type;
118 typedef value_type* pointer;
119 typedef const value_type* const_pointer;
120 typedef value_type& reference;
121 typedef const value_type& const_reference;
122 typedef std::size_t size_type;
123 typedef std::ptrdiff_t difference_type;
140 region(other.region) {}
143 inline RegionAllocator(
const RegionAllocator<U> & other) :
144 region(other.region) {}
146 inline ~RegionAllocator() {}
148 inline pointer address(reference r) {
return &r; }
149 inline const_pointer address(const_reference r) {
return &r; }
151 inline pointer allocate(size_type cnt,
152 typename std::allocator<void>::const_pointer = 0) {
155 inline void deallocate(pointer p, size_type) { }
157 inline size_type max_size()
const {
158 return std::numeric_limits<size_type>::max() /
sizeof(T);
163 RegionAllocator& operator=(
const RegionAllocator<U>&) {
return *
this; }
166 inline void construct(pointer p,
const T& t) {
new(
static_cast<void*
>(p)) T(t); }
167 inline void destroy(pointer p) { p->~T(); }
169 inline bool operator==(RegionAllocator
const& a) {
return region == a.region; }
170 inline bool operator!=(RegionAllocator
const& a) {
return !operator==(a); }
180 typedef T value_type;
182 typedef std::list<T, allocator > type;
183 typedef typename type::iterator iterator;
192 typedef T value_type;
194 typedef std::vector<T, allocator > type;
195 typedef typename type::iterator iterator;
202 template<
class K,
class T,
class C=std::less<K> >
205 typedef std::pair<const K, T> value_type;
207 typedef std::map<K, T, C, allocator > type;
208 typedef typename type::iterator iterator;
An STL allocator that allocates out of a memory region.
AA_API void aa_mem_region_pop(aa_mem_region_t *region, void *ptr)
Deallocates ptr and all blocks allocated after ptr was allocated.
AA_API aa_mem_region_t * aa_mem_region_local_get(void)
Return pointer to a thread-local memory region.
AA_API void * aa_mem_region_ptr(aa_mem_region_t *region)
Pointer to start of free space in region.
AA_API void * aa_mem_region_alloc(aa_mem_region_t *region, size_t size)
Allocate size bytes from the region.
Data Structure for Region-Based memory allocation.
Typedefs for STL lists using region allocator.
Typedefs for STL map using region allocator.
Typedefs for STL vector using region allocator.