|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2001-08-18 17:20:37
On Saturday, August 18, 2001, at 05:55 PM, John Max Skaller wrote:
> Summary: don't fix shared_pointer. Use array<T,n> instead.
> This is well principled. The specialisation is not.
Sometimes a programmer needs a dynamically allocated array of objects
with the array length not known until run time. And sometimes vector
will not fit the bill. I've even had good reason to use this concept
(actually it was more a scoped_array) recently in my own code.
I (perhaps mistakenly) assumed that the argument over whether
shared_array should exist at all had already been debated and settled in
favor of the existence of shared_array<T> (as it exists in boost). I
was not expecting to re-open this issue.
Rather I merely intend to ask if shared_ptr<T[]> might be a better name
than shared_array<T>. I think it may be a better name merely because
there is one less class name to remember. The T[] syntax can be
recycled with scoped_ptr or even auto_ptr if we so choose. The
interface seems a little easier to learn to me.
But whether or not the concept is named shared_ptr<T[]> or
shared_array<T>, I think it should exist. vector will not always do the
job (though I agree that most of the time vector /is/ a better choice).
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk