Hi,
I think this says it all:
std::array allows one to avoid ordinary arrays and provides advantages so that it works with the STL.
Even better it allows one to avoid using
new and
delete
A fixed length array is handy sometimes, otherwise one would just use a
std::vector for a lot of things, unless there is an advantage in using some other STL container.
| What other data structures can the two methods accommodate? |
You know that STL containers can be nested, right?
1 2 3 4 5 6 7 8 9
|
struct Cell {
// Cell info
.
.
.
};
std::vector<std::array<Cell,10>> CellData;
|
Apparently the nesting can be arbitrarily deep, but things could become harder to understand and deal with if one has too much of a wacky data structure.
| Is the std::array been the new standard? |
I would prefer
std::array over an ordinary array, and almost anything else over using
new and
delete. Try to use the STL as much as possible, use smart pointers if you really need to.