dsharlet / array

C++ multidimensional arrays in the spirit of the STL
Apache License 2.0
198 stars 15 forks source link

Add shape::, array_ref::, and array::bounds() #105

Closed fbleibel-g closed 2 months ago

dsharlet commented 2 months ago

How does this relate to #83? This looks similar to a suggestion I made there:

What if we just have a helper that drops all strides from shape? And maybe also try to make shapes easier to work with if you don't care about strides (if that's even an issue now)? array/array_ref could have a helper function bounds() that just returns the shape with all strides removed.

https://github.com/dsharlet/array/pull/83#pullrequestreview-1234132959

I haven't been that happy with anything along these lines, but after so many years we should just go with what you have here.

fbleibel-g commented 2 months ago

This looks just like what you suggested. We also discussed this on Chat a while back and I think bounds() was the winner for this particular problem. If you don't have any objections then, I'll merge this in.