Boost logo

Boost :

From: gibav_at_[hidden]
Date: 2000-12-03 16:25:27


--- In boost_at_[hidden], Jeremy Siek <jsiek_at_l...> wrote:
> [...]
>
> Perhaps what you had in mind in your reply is changing the number of
> dimensions of an array "in-place". This is certainly possible in
terms of
> creating an ArrayRef... creating an ArrayRef with a different
number of
> dimensions than the underlying Array.

Yes, creating a new ArrayRef is feasible, and would be a nice idea.
Bur changing the number of dimensions of an existing Array ("in-
place") would be impossible with my implementation, that's what I
meant.

> [...]
> Another related issue to consider (perhaps you were alluding to
this in
> your email) is whether it is really necessary/desirable to encode
the
> number of dimensions as a template parameter of the array class. I
can
> imagine an implementation of the operator[] proxy just encoding the
> current dimension as a run-time integer instead of a template
parameter. I
> wonder if there would be performance differences? Are there any
other
> trade-offs to consider? code size, compilation speed, etc.
>

I was not alluding to this in my previous mail. The main trade off
that comes to mind is type safety. If at compile time you don't know
the number of dimensions, how can the compiler know if a set of
operator [] should yield a reference to an individual element or to
ann intermediate ArrayRef? For this reason alone, I would not like
that solution. Besides, I think that changing number of dimensions
would create unintuitive behaviour in the Array, perhaps with the
exception of the case where one of them is monodimensional.

Thanks for your frequent contributions!

Giovanni Bavestrelli


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