|
Boost : |
Subject: [boost] [array] Support for multidimensional arrays?
From: Peter Dimov (lists_at_[hidden])
Date: 2015-05-05 19:34:05
Currently, creating a multidimensional boost/std::array is a bit unwieldy:
array<array<array<int, 5>, 4>, 3> a; // int a[3][4][5]
a[2][3][4] = 5;
As a first step, we should consider enabling the element type T of array<T,
N> to be an array type.
array<int[4][5], 3> a; // int a[3][4][5]
a[2][3][4] = 5;
This almost works already, except for the array interface functions
specified and implemented in terms of, say, std::equal or std::fill.
It is an open question whether these standard algorithms should not be fixed
themselves to work on array types, as swap_ranges has been, but for now, we
can implement the array functions in a way that works.
Opinions on that part?
If we agree that this is a good idea, the next logical step would be to
eliminate the special handling of the first extent and simply allow
array<int[3][4][5]> a; // int a[3][4][5]
a[2][3][4] = 5;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk