
On Tue, Nov 1, 2011 at 4:29 PM, Richard Hadsell <hadsell@blueskystudios.com> wrote:
Don't you keep the size somewhere else? The array seems kinda useless when you don't know the size.
Sure, but it's a lot easier to just test the pointer. You can replace a plain old pointer with a scoped_ptr or scoped_array without changing any code, except where the object or array is allocated and deleted.
Actually, what is the problem? Do you use (NULL) or (0) instead of just () (for construction).
If I replaced a pointer to an array with a std::vector, the code would be entirely different, and it would take up more memory. If I had tens of thousands of these pointers (which I do), I would definitely stick with the current scoped_array and adamantly protest any suggestion that would increase the memory footprint (as I once did a while ago).
This proposal does not change the footprint, does it? -- Olaf