$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: [boost] [multi_array] typed subarray from raw memory
From: Maxim Yanchenko (MaximYanchenko_at_[hidden])
Date: 2011-10-31 20:11:01
Hi,
While using multi_array, I found I frequently need a way to view some memory
which is a multi-dimensional array and I don't know the type of the element, but
I know its size and I know that this element has a member of the type I need
(and I know the offset).
So I need to be able to write something like
struct A { double x, y; };
void* p = mmap(...);
size_t el_size = size_of_element_in_p;
size_t offset = offset_of_A_inside_element;
boost::multi_array_typed_view<A, NumDims>
my_view(p, extents, el_size, offset );
and have a standard multi_array-compatible interface.
Also, with existing multi_arrays of known types, this feature will give a way to
create views of element's members (the closest we have now is a strided view but
it only works if the element size is a multiple of the member size).
I filed a Feature Request for multi_array
(https://svn.boost.org/trac/boost/ticket/6073), but I wonder if there are any
other possibilities around, and I'd also like to know what the community think
of necessity of this feature.
Thanks,
Maxim