Hacker News new | past | comments | ask | show | jobs | submit
Span lets you use a ranged for loop to iterate over the contents without worrying about exceeding the bounds, which is safer than pointer+size if that's all you'll be doing. C++26 also introduces .at() for span, and the new hardened standard library enforces bounds checking when using operator [] on a span.
The caller still needs to construct the span correctly.
loading story #48468225