Boost logo

Boost :

From: Serge Barral (sbarral_at_[hidden])
Date: 2001-04-02 11:21:44

On Mon, 02 Apr 2001 17:26:06 Jeremy Siek wrote:
> On Mon, 2 Apr 2001, Serge Barral wrote:
> sbarra> Actually, the result of A[3 <= stride(2) < 7][all][0 <= stride(1)
> < 10]
> sbarra> would be a 3 dimensional subarray.
> sbarra> The current proposal suggests that subarrays will support
> indexing, but how
> sbarra> about slicing? Is it really often necessary in practice?
> I think it is important to keep subarray's as close to array's as
> possible... it is conceptually simpler for the user that way.

I see. But then what's the type of a subarray of subarray?

> [...]
> sbarra> But if my assumption above is correct, I don't understand how the
> result of
> sbarra> indirect slicing and the result of slicing with Range objects can
> be of the
> sbarra> same type, since these are two different kind of views.
> I don't either ;) They will need to be different types. I haven't figured
> out how to express the different types yet (in terms of the interface
> presented to the user).

Blitz solves the problem by not documenting subarray types :-). The user
just knows that they behave like and are convertible to normal arrays. It
makes sense in the case of Blitz (and of other expression template
libraries) since anyway the result of most operations involving arrays is
not strictly of type array. Note that it also solves the problem mentionned
above (subarray of subarray)...
One problem I can see with this approach is that the user cannot store
subarrays efficiently (a conversion to array is required). Are there other
good reasons for documenting the exact type of subarrays?


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