
On 12/6/24 20:09, Claudio DeSouza via Boost wrote:
On Fri, 6 Dec 2024 at 17:05, Andrey Semashev via Boost < boost@lists.boost.org> wrote:
On 12/6/24 20:00, Claudio DeSouza via Boost wrote:
I’m clarifying things. Putting safety in quotes and asserting span can’t be used because of simd or fixed sized annotations is just not the case.
I'm not saying that span can't be used. I'm saying there are downsides to it and there probably are better alternatives in this case.
But the examples you presented of downsides are not applicable. If hash2 wants to encode buffer size in the interface then there are tradeoffs, but span can accommodate to those. Claims of span not being compatible with simd or other optimisations are just not the case. So the downsides mentioned pretty much are no applicable as opposed to any alternative.
The only way to reliably avoid the potential overhead of span and e.g. load the data from it e.g. into a SIMD register is to get a pointer into the span. And if you want to avoid bounds checked on every iteration, you would have to resort to pointer arithmetics. At this point, what additional safety does span bring?