[multi_array] Slices, views and sub_arrays
Hi All
I'm still plugging away at trying to make use of multi_array, but I
seem to be having a few problems! I suspect my understanding
of the basic paradigm is flawed.
I'm bit confused about views and slices. If I start with a rectangular,
2 dimensional grid, take a view of the whole grid, and then use a
single subscript to index into that view, then I expected the result
to be a view of one less dimension then the original view. However,
it seems to be a "sub_array".
#include "boost/multi_array.hpp"
struct Cell { int i; };
int main( )
{
typedef boost :: multi_array_types :: index_range range;
boost :: multi_array< Cell, 2 > grid( boost :: extents[ 9 ][ 9 ] );
boost :: multi_array< Cell, 2 > :: const_array_view< 2 > :: type
const_grid_view =
grid[ boost :: indices[ range( ) ][ range( ) ] ];
boost :: multi_array< Cell, 2 > :: const_array_view< 1 > :: type
const_row_view =
const_grid_view[ 5 ];
return 0;
}
The error message from the last assignment is this
sample.cpp: In function `int main()':
sample.cpp:13: error: conversion from
`boost::detail::multi_array::const_sub_array
participants (1)
-
Robert Jones