|
Boost : |
From: John Maddock (jz.maddock_at_[hidden])
Date: 2022-01-01 16:56:23
> The bottom line is that such a multi-dimensional array would be a much
> more complicated component that is drastically different from the
> one-dimensional array. At the same time, array<> is supposed to be a
> thin and lightweight replacement for the language built-in arrays. IMO,
> it is not a worthy tradeoff.
>
> BTW, you still have the multidimensional language built-in arrays. Why
> can't you use those?
They're not as convenient or safe I would say.
Interestingly Boost.Math uses 2-D arrays all over the place for test
data, and I've always used an array<array<T, N>, M> and never really
thought about an alternative, but IMO it does rather make sense.Â
Dereferenced iterators and operator [] would return a simple "smart
index" object I guess, similar to Boost's Multi-Array. BTW the catch
with multi-array is that it's dynamically allocated (more like a
vector), where as the nice feature of std::array is the all static,
constexpr initialization.
So yes, I can see the point of view of the OP, and I don't even think it
would be that hard or large to implement, it just doesn't get over the
"need to have" barrier for me to want to do it ;)
Best, John.
-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk