Search⌘ K
AI Features

A Constant Range of Modifiable Elements

Explore the concept of std::span in C++20 to understand how it models a constant range of modifiable objects. Learn the distinctions between modifiable and constant ranges using vectors and spans, and how std::span enhances sequence handling by referencing contiguous data without owning it.

We'll cover the following...

Kilian Henneberger reminded me of a special use case of std::span, i.e., a constant range of modifiable elements.

For simplicity, I name a std::vector and a std::span a range. A std::vector, like an std::string models a modifiable range of modifiable elements: std::vector<T>. ...