Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-01-09 11:36:35

Gavin Collings writes:
> jsie-_at_[hidden] wrote:
> original article:
> >
> > There is a close relative to the array class that is also very
> > usefull: an array based on just a pointer to some memory "borrowed"
> > from somewhere else, an array_ref class.
> It seems like a useful service to provide, but it leaves the
> responsibility for construction and destruction of array elements to
> derived classes. This is easy for a derived class using a fixed array
> anyway, but in general, the derived class would want to just hand over
> a chunk of memory and get back an initialised (or optionally
> uninitialised (?) array), and similarly have the destruction taken care
> of in the array_ref destructor. IOW it seems to me that since

I wasn't thinking in terms of derived classes with array_ref...
here's the kind of scenario I was thinking of: you're interfacing
to some old Fortran code which has some arrays already allocated
and initialized, and now you want to wrap them up for use in
your C++ code.

> array_ref takes raw memory and turns it into an array, it makes more
> sense for it to provide array style initialisation too.

Do you mean the initializer list? I wasn't intending array_ref to
be fixed size.



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