Opened 13 years ago
#3224 new Feature Requests
shape() should return a RandomAccessCollection
Reported by: | fhess | Owned by: | Ronald Garcia |
---|---|---|---|
Milestone: | Boost 1.40.0 | Component: | multi_array |
Version: | Boost 1.39.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Has there ever been any thought to making multi_array::shape() return something that models the Collection concept (RandomAccessCollection in particular I suppose) rather than a raw pointer? This would allow the return value from shape() to be passed directly to multi_array::reshape() or multi_array::resize(), for added convenience. It would also allow a debug assertion to be added to make sure you don't try to access beyond the end of the array returned by shape().
From looking at the multi_array code, it looks like it would be relatively easy to add a new function called maybe "size()" which would replace "shape()" (which could be kept but deprecated) where size() would return a const reference to the boost::array used internally to store the extent_list_.