
On Mon, Mar 2, 2009 at 17:56, Matt Calabrese <rivorus@gmail.com> wrote:
On Mon, Mar 2, 2009 at 4:32 PM, Thorsten Ottosen < thorsten.ottosen@dezide.com> wrote:
Christopher Jefferson skrev:
You could make exactly the same argument about pushing back into a vector, why not have a push_back_unchecked that doesn't check if reallocation must occur. I did once experiment with this and got no measurable speed improvement.
So did I in a real-time ray-tracing application. The difference was a deal-breaker.
I definitely see this tool as being all about low-level optimization, which is one of the few things we can say almost for certain concerning its domain of usage, so it might as well directly offer as much functionality in that regard as possible.
LLVM has a similar class, FWIW: http://llvm.org/docs/ProgrammersManual.html#dss_smallvector It seems to be entirely about reducing heap overheads, though, with apparently no need for *_unchecked functions. It seems to me that if you need unchecked, then the class shouldn't be storing the capacity at all (outside of debug versions), as it's unnecessary overhead, which suggests to me that it would be the domain of a separate, obviously unsafe class (unchecked_vector?). ~ Scott