I’m trying to make a small, fixed-sized matrix struct. In order to do it, I need some fixed-sized stack-allocated buffer for values of a given type. In the standard library I found StaticArray and InlineArray that look like good candidates, but I’m not sure what their fundamental differences are. Two of the most significant differences (for me) are:
- StaticArray is register passable while InlineArray is not (since InlineArray only requires the elements to satisfy the CollectionElement trait).
- InlineArray allows you to get a pointer to the buffer, but StaticTuple does not.
Is there a rule of thumb about when someone should use one over the other? And are these types meant to serve two distinct purposes?