1 #ifndef _RHEOLEF_STACK_ALLOCATOR_H
2 #define _RHEOLEF_STACK_ALLOCATOR_H
28 #include "rheolef/compiler.h"
29 #include "rheolef/pretty_name.h"
75 trace_macro (
"stack_allocator cstor");
90 trace_macro (
"stack_allocator dstor");
120 new(
reinterpret_cast<void*
>(
p) )
T(
c);
135 trace_macro (
"allocate "<<
n<<
" type " << typename_macro(
T));
141 trace_macro (
"stack is full: throwing...");
142 throw std::bad_alloc();
148 trace_macro (
"deallocate "<<
n<<
" type "<<typename_macro(
T));
170 trace_macro (
"stack_allocator::mem_info cstor NULL");
178 trace_macro (
"stack_allocator::mem_info cstori: size="<<
max_size);
182 trace_macro (
"stack_allocator::mem_info dstor: size="<<
max_size);
192 template <
typename T1>
195 return lhs.get_handler() == rhs.get_handler();
197 template <
typename T1>
200 return lhs.get_handler() != rhs.get_handler();
stack_allocator & operator=(const stack_allocator &sa)
stack_allocator(unsigned char *stack, size_t stack_size)
pointer allocate(size_type n, const void *=NULL)
pointer address(reference r) const
void construct(pointer p, const_reference c)
void construct(pointer p)
const handler_type * get_handler() const
size_type max_size() const
stack_allocator(const stack_allocator &sa)
std::ptrdiff_t difference_type
void deallocate(pointer p, size_type n)
const_pointer address(const_reference c) const
stack_allocator(const stack_allocator< U > &sa)
const T & const_reference
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
bool operator==(const heap_allocator< T1 > &lhs, const heap_allocator< T1 > &rhs)
bool operator!=(const heap_allocator< T1 > &lhs, const heap_allocator< T1 > &rhs)
handler_type(unsigned char *stack1, size_t size1)
stack_allocator< U > other