On 10/9/13, Robert Ramey
I'm still thinking that boost multi-array is not appreciated to the extent that it should be. I would like to see it enhanced to accomodate compile time extents. Of course even that would have a ripple effect into the multi-array concepts so maybe it's too hard to do.
On 10/9/13, Robert Ramey
I'm still thinking that boost multi-array is not appreciated to the extent that it should be. I would like to see it enhanced to accomodate compile time extents. Of course even that would have a ripple effect into the multi-array concepts so maybe it's too hard to do.
The maps directory in the Sandbox includes an array like that. It's a fixed size array whose memory can be statically or dynamically allocated, dependent on allocator type. The combination of both is probably a mistake, since a dynamically allocated N-dimensional array requires N memory allocations, whereas a heap allocated static array requires only one. In the static case it generates an intrinsic member array from the set of compile time bounds passed as a template parameter, written before variadic templates became available. It is somewhat similar to Daryle's array_md, and includes a view class to generate subarray views of larger arrays. The directory also contains a resizable array that needs a name change, it's called pointer, multi-array was taken, and like multi-array it's fixed size at any given time. An N-dimensional array of type pointer makes N memory allocations when passed a set of bounds and whose elements can be accessed using the normal indexing operator notation. Accessing views is possible using either the class's type definitions or a view class designed for that purpose. Also include are fixed size scalar, vector and matrix expression templates in case of interest. I have since asked this list for interest in a statically allocated array that makes use of variadic templates. It is currently in the review queue and is located at, https://github.com/BrianJSmith/Array If you require a compile time array you could give that a try. Generating views can be achieved using the class's type definitions, however, no specific view class is available. I have updated the pointer class to use initializer lists during construction, resizing and element access, it is not publicly available, although if there's any interest I can make it so. The N memory allocations clearly make it slower to construct than a similar multi-array, however, with element access it generally has better performance. The view class for it needs some rewriting and perhaps an iterator class. The begin and end methods return the address of the first and one passed the last data elements, although, that is also true of the view class whose elements can be the addresses of elements in the array the view represents. Regards Brian -- www.maidsafe.net