red floyd <no.spam.here@its.invalid> writes:
Other than not reinventing the wheel, which you've discussed,
I'd go with std::array<std::array<T,M>,N> as the data type
I'd also make the data member private, and overload
operator()(int row, int col). But that's just me.
Does this mean that the outer array holds pointers to the
inner arrays? AFAIK, a C-array cannot be directly contained
in another C-array, and ::std::array is just a thin wrapper
around C-arrays. In this case, wouldn't this make access
more slow, because all the arrays do not necessarily sit at
one place in memory but might be distributed in different
places of memory, while a T[ N, M ] C-array is a single
region of memory and modern microprocessor architecture
prefers sequences of accesses to neighboring objects?
No, it means the outer array has members which are arrays.
a first-class object.