On Mon, Nov 18, 2013 at 10:08 PM, Trevor Saunders <tsaund...@mozilla.com> wrote: > On Mon, Nov 18, 2013 at 10:03:53PM +0100, Marc Glisse wrote: >> On Mon, 18 Nov 2013, Trevor Saunders wrote: >> >> >This patch adds a class auto_vec which releases its internal >> >storage in its destructor, but unlike stack_vec it has no built in >> >storage so its reasonable to use it in objects on the heap. It >> >then replaces a bunch of vectors on the stack with stack_vec if >> >the initial creation size was a compile time constant or auto_vec >> >otherwise. >> >> Why not use stack_vec<T, 0>? You could partially specialize it if there >> is waste, and you could make the 0 implicit. > > I'd like to see it get used for stuff on the heap, but that depends on > or at least only makes sense once other stuff uses destructors.
Using stack_vec would be odd, but yes, making the 0 implicit and adding a constructor with element count would make sense. Of course then we'd have auto_bitmap but stack_vec, that's a bit inconsistent. So in the end I think the patch is ok as-is. Please wait for further comments though. Thanks, Richard. > Trev > >> >> -- >> Marc Glisse