[Boost-bugs] [Boost C++ Libraries] #4045: MultiArray implementation from base, extents, strides

Subject: [Boost-bugs] [Boost C++ Libraries] #4045: MultiArray implementation from base, extents, strides
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-03-25 14:38:29

#4045: MultiArray implementation from base, extents, strides
 Reporter: Rhys Ulerich <rhys.ulerich@…> | Owner: garcia
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: multi_array
  Version: Boost 1.42.0 | Severity: Not Applicable
 Keywords: |
 It would be useful to have a multi_array_ref constructor or some other
 MultiArray implementation that can accept explicit stride information
 rather than storage order information. The former is more flexible and
 can accomplish things the latter cannot (see example below).


 I sent the following question to boost-users (http://lists.boost.org

 I'd like to obtain an N-dimensional MultiArray implementation given a base
 pointer, N extents, and N strides. My use case requires padding the
 stride in one dimension in a way seemingly not obtainable taking views of
 the usual boost::multi_array_ref.

 Code like the following would be ideal
    boost::array<std::size_t,3> extents = { 2, 3, 4 };
    boost::array<std::size_t,3> strides = { 1, 2, 7 }; // Note 7 not 6
    boost::scoped_array<int> raw(new int[extents[2]*strides[2]]);

    using boost::detail::multi_array::multi_array_view;
    multi_array_view<int,3> a(raw.get(), extents, strides);
 except that the appropriate constructor in multi_array_view is private
 boost::detail::multi_array::sub_array would also be ideal if it's
 constructor was accessible (boost/multi_array/subarray.hpp:370). I can
 make either accessible by #defining BOOST_NO_MEMBER_TEMPLATE_FRIENDS, but
 that's evil.

 Am I missing something in Boost.MultiArray? Or is there no publicly
 accessible way to provide a custom stride list?

Ticket URL: <https://svn.boost.org/trac/boost/ticket/4045>
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:02 UTC