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<Cell, 1u, const Cell*>' to non-scalar
 type `boost::detail::multi_array::const_multi_array_view<Cell, 1u, const Cell*>' requested

which seems to confirm I've got all my consts and dimensions correct.

So, why is this wrong?

Also, does the return type of sub_array, rather than array_view, mean that the contents
of the relevant cells have been copied?

Thanks

- Rob.