Some programmers seem to violently hate them, while others seem to think they\'re fine. I know that anything that can be done to a multi-dimensional array can also be done to a
If multidimensional index computation bugs you, std::valarray with std::slice is the standard abstraction.
Well, in C++ I dislike multidimensional arrays because they should be replaced with std::vector<std::vector<t> >
. They're also particularly important if you want to represent a std::vector<std::basic_string<t> >
.
Multidimensional arrays are so simple a primitive I'm suprised most would care. However, a design that uses a single dimension is probably better than one using multiple dimensions, all other things being equal.
There are following advantages of multi-dimensional arrays over Vector<Vector<>>
: