Boost logo

Boost :

From: rgarcia1771 (garcia_at_[hidden])
Date: 2002-01-07 15:52:32


--- In boost_at_y..., "rwgk" <rwgk_at_y...> wrote:
> At the top of multi_array_ref.html it says:
>
> multi_array_ref does not own the data passed to it.
>
> Then:
>
> multi_array_ref& operator=(const multi_array_ref& x)
> Assignment operator. This performs a deep copy of the other
> array. Note that array dimensions must agree.
>
> Who owns these data? The returned multi_array_ref?
> Do some multi_array_ref own data?
I should clarify this in the documentation. multi_array_ref does not
take ownership of the *memory* passed to it. In other words, it does
not attempt to delete the memory block when it is destructed.

A multi_array_ref refers to the same block of data
for its entire lifetime. Any operations that modify the data
in a multi_array_ref will modify the memory block passed to it. By
memory block, I mean the locations in memory
[multi_array_ref::data(),
multi_array_ref::data()+multi_array_ref::num_elements())

In contrast, multi_array allocates its own block of memory for data
and releases it when destructed.

ron


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