Boost logo

Boost Users :

From: Ronald Garcia (garcia_at_[hidden])
Date: 2004-11-15 10:35:29


Hi Kevin,

On Nov 10, 2004, at 7:09 PM, Kevin Bluck wrote:

> With regard to boost::multi_array:
>
> Please, will somebody explain the difference between a View and a
> Subarray? I have read both the user and reference documentation, and
> can't find anything that indicates to me when you would use one over
> the other. So far as I can tell, they are essentially identical in
> purpose.

Views and Subarrays are very similar, that is true, but they are not
quite identical. Subarrays are specifically the return type of
operator[](index). When you index into a model of the MultiArray
concept, you will get a subarray back.

Views, on the other hand are, as the name suggests, for taking more
generalized views of an array, for example a slice along some
dimensions. As such, a view can look at a portion of a multi_array the
same way that a subarray can, but the subarray is more specialized for
its purpose.

HTH,

ron


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net