[Boost-bugs] [Boost C++ Libraries] #6073: typed subarray from incompatible/raw memory

Subject: [Boost-bugs] [Boost C++ Libraries] #6073: typed subarray from incompatible/raw memory
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-31 09:28:39


#6073: typed subarray from incompatible/raw memory
------------------------------------------------------+---------------------
 Reporter: Maxim Yanchenko <Maxim.Yanchenko@…> | Owner: garcia
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: multi_array
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
------------------------------------------------------+---------------------
 Consider this example:
 {{{
 struct A { double x, y; };

 struct B : A { double z; };
 struct C { A a; double z; };
 struct D { double z; A a; };
 struct unknown { ...; A a; ....; };
 }}}
 Let's say I have in memory an n-dimensional array of B, or C, or D, or
 even unknown structure where I know only total size of the element and
 offset of A inside it, both in run-time (e.g. a binary file produced by
 NumPy.mmap).

 What I need is a multi_array_view that could behave as an multi_array of
 A, given the sizeof of "real" element containing A, and offset of A inside
 it, like this:
 {{{
 void* p = mmap(...);
 size_t el_size = size_of_element_in_p;
 size_t offset = offset_of_A_inside_element;

 boost::multi_array::multi_array_typed_view<A, NumDims>
   my_view(p, extents, el_size, offset );
 }}}

 Strided view (boost::detail::multi_array::multi_array_view) could do the
 job in simple cases when size of "real" element is a multiple of
 sizeof(A), but not in the above case.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6073>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC