|
Boost : |
From: Michael Marcin (mike_at_[hidden])
Date: 2007-03-01 01:27:15
I have functions like say a quartic equation solver that can return a
variable number of solutions. It would be clean IMO to return or pass
by reference a std::vector or like container that store the solutions.
However heap allocation is fairly expensive here so the usual solution
is to have a local array with max solutions elements and pass that by
reference into the solver and return the number of solutions. This is
ugly to use and read. Is there a library for stack-based std-like
containers? Alternatively is it possible to make an compatible
stack-based allocator for std::vector using alloca?
Thanks,
Michael Marcin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk