Remove the code which checks the heap against the stack to determine
if there is space left. Using the stack pointer as a limit causes
problems when used with an RTOS since the stack pointer depends
on the current thread which can use a user-allocated stack residing
anywhere in memory.
FuncPtr provides a more flexible templated function class as a
replacement for FunctionPointer.
FuncPtr provides an intuitive template interface:
void doit(int, char *);
FuncPtr<void(int, char *)> doit_ptr(doit);
doit_ptr(10, "hi!");
FuncPtr places memory management on the user, only supporting
storing an extra pointer for pointers to externally stored objects
that can be passed to the function. Additional binding can be
supplied by an external class.
FuncPtr<void(int)> hello(&object, &Object::method);
Additionally FuncPtr provides a copy constructor, allowing FuncPtrs
themselves to be passed to existing interfaces.
FuncPtr<void()> hello(doit); ticker.attach(hello, 1000);