Boost Users :
Subject: [Boost-users] Multi-Array indexing
From: todd keeler (tkeeler_at_[hidden])
Date: 2008-10-20 15:37:33
Hi, I'd like to understand how the Boost Multi-array implements
multiple indexing using the regular square bracket operator.
I've waded through the template code for a few hours, from what I
understand, there's a nested bunch of sub-arrays which leads to a final
object which offers a reference into the data array.
I still can't figure out, however, how it solves this problem:
Consider a Multi-Array A with dimension 3,
A[ i ][ j ][ k ]
requires a call to
A[ i ] which returns a Subarray, S1
The subarray gets indexed
S1[ j ]
and another subarray S2 is returned.
however S2[k] doesn't return a subarray, but a
reference to the data in the multiarray.
However, S1 and S2 are the same object (subarray), hence require the
same overloaded operator, returning the same type.
making this unfeasible.
Therefore, the only way I can think to eliminate this dilemma is to
have a different object type for every dimension. I'm not sure if this
is what Multi-array does, but I'd sure like to know how it's done .
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net