Boost logo

Boost :

From: rgarcia1771 (garcia_at_[hidden])
Date: 2002-01-09 15:33:47


--- In boost_at_y..., "rwgk" <rwgk_at_y...> wrote:
> Thanks for your reply.
>
> Could you please also address this question:
>
> > Multi-dimensional arrays tend to be large (mega-bytes). On the
other
> > hand, the copy constructor and the assignment operator perform
deep
> > copies. Then, how would I code e.g. operator+()?
> >
> > marray operator+(const marray& lhs, const marray& rhs) {
> > marray result;
> > // do the addition
> > return result; // deep copy???
> > }

Yes providing handle-based copy operations was a design decision I
considered while writing multi_array. I used deep copy semantics in
order to keep it in line with the other standard library containers.
  I wonder if it may be possible to provide the semantics you need
while retaining the spirit of the current standard containers...

When multi_array is used for non-numerical purposes, a handle-based
copy would be unintuitive, especially when considering the semantics
of the other standard library containers. I am under the impression
that handle copying is useful primarily for arithmetic operator
implementation. I will give this more thought.

Cheers,

ron


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk