I have two questions:
1) Is it possible to implement an allocator that uses alloca to allocate memory on the stack and is otherwise C++ STL compliant?
If there is code out there, you can make me happy by simply pointing me to the URL. :-) If there is no code out there, perhaps you can sketch the functions allocate and deallocate?
2) If the answer to the above question is 'yes', I'd like to understand how it is possible to allocate memory on the stack for class members. As an example, consider an
std::vector<int, AllocaAllocator<int> >
and suppose that a call of the member function 'resize' of this vector calls first 'deallocate' and then 'allocate' of the allocator.
The scope from which allocate is called is that of the member function resize. Doesn't this mean that the allocated memory is removed from the stack at the end of that function call?
Kind regards, Bjoern