
There was an overlong discussion about this some time ago. You could look at boost::auto_buffer. I also have a system that does this using a generalised allocator in the sandbox http://tinyurl.com/o56t5u. Two immediate issues are alignment and the fact that you are using a stateful allocator. However, in the case you provide it would work. It's just not a very interesting case. Cheers, Christian. On Fri, Aug 14, 2009 at 6:21 AM, Mateusz Loskot <mateusz@loskot.net> wrote:
Stefan Strasser wrote:
I recently ran into the problem that a local container on the stack, which was likely to be very small, but its size was still not known at compile-time, consumed a considerable amount of runtime because of allocation/deallocation. [...]
I'd try to find out if the std::vector of that implementation doesn't provide short array optimisation. Peraps STLport does, I'm not sure. That would solve this issue.
Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost