Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-08-19 13:59:08

Howard Hinnant wrote:
> 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.

        Yes, I agree: this is what a C VLA does, so WG14 agrees too :-)

> And sometimes vector will not fit the bill.

        I agree. My main contention is that

        a) we should drop shared_array
        b) we should use

                shared_ptr< array<T> >
                shared_ptr< fixed_array<T,n> >

instead of

                shared_ptr< T[] >
                shared_ptr< T[n] >

That is: don't specialise shared_ptr. Instead, make
first class array types for fixed length arrays
of both the types (1) length constant known at compile
time and (2) length constant bound at construction time.
[And use vector for (3) length variable]

The reason is:

        1) the first class types have uses
                other than shared objects

        2) there is no need to specialise shared_ptr
                for such first class types

I.e.: I agree with removing shared_array and using shared_ptr,
but suggest that instead of a specialisation, to use first class
array types.

John (Max) Skaller, mailto:skaller_at_[hidden] 
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
New generation programming language Felix
Literate Programming tool Interscript

Boost list run by bdawes at, gregod at, cpdaniel at, john at