Boost logo

Boost :

From: Claudio DeSouza (cdesouza_at_[hidden])
Date: 2024-12-06 22:15:29


Yes, that's the naive way to implement it. Like I said, depending how
dedicated you are, in modern C++ you can pretty much just fold something
like that in an elegant way. Also, you need to understand that "just using
a pointer" doesn't necessarily mean no checks either in many cases.

I think the main issue here is that with span we can eliminate all the
arithmetic around subscript access, which makes code more readable, and
harder to get wrong, while delivering the same result, and with tools that
allow us to provide the compiler with more information about what we are
doing. So the overall result is something more robust than "just a
pointer", and the safety becomes just a natural conclusion of this.

Claudio.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk