|
Boost : |
From: Gavin Collings (gcollings_at_[hidden])
Date: 2000-12-07 09:42:13
--- In boost_at_[hidden], kris.thielemans_at_i... wrote:
> I'd agree, if there is a way to let the higher-level class do this
> without performance penalty, and I don't think so. The higher level
> class would have to subtract all the offsets all the time, before
> passing it to Array::operator[]. If you build it in in Array, and
> you store pointers towards to 0 index, you don't have any
> performance penalty.
When talking about operator[], you're talking about random access
anyway, so at least one offset addition is going to be necessary.
Also, the way we have operator[] defined is to return a N-1
dimensioned object which implies a fairly hefty operation is being
undertaken. All in all, I don't think that the extra integer
addition is likely to impact performance much, but who knows; a
timing test might prove interesting.
Generally, I agree with the unnecessary featurism comment. If,
though, there is enough interest, then, as others have suggested,
definining a fortran, proxied view (by analogy with flattened_array,
with friendship relationship if necessary) would get my vote.
Gavin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk