Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2000-12-07 11:28:13

In message <90o7k5+5gfj_at_[hidden]>, Gavin Collings
<gcollings_at_[hidden]> writes
>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.

I ran a simple informal test, and couldn't come up with anything
statistically significant.

As Dave pointed out, this is really the domain of the compiler. If we
were to identify a genuine bottleneck we would then have cause to
revisit the issue. I personally doubt that this will be the case. I'm
also aware that the original and subsequent developers of the STL had
algorithmic performance very much in mind, and this never appears to
have been an issue.

>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.

Agreed. If you want an alternative view on the world, it seems easy
enough to define your own window :-)


  Kevlin Henney phone: +44 117 942 2990
  Curbralan Limited mobile: +44 7801 073 508
  mailto:kevlin_at_[hidden] fax: +44 870 052 2289

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