My embedded system got a C++11-capable version of g++, so I've been cleaning up code from
for( uint16_t* p = array; p < (&array)[1]; ++p ) {
*p = fill_value;
}
to
for( uint16_t& r : array ) {
r = fill_value;
}
which is much more readable.
Is there a range-based for loop which operates over all elements of array2[m][n]
?
The old version is
for( int16_t* p = array2[0]; p < (&array2)[1][0]; ++p ) {
*p = fill_value;
}
and I don't want nested loops, unless it's guaranteed the compiler will flatten them.
(FWIW, the compiler is the GNU 4.7.4 Linaro g++ ARM cross-compiler that ships with TI Code Composer Studio 6.0.0)