In this article, we’ll look at std::span which is more generic than string_view and can help work with arbitrary contiguous collections. A Motivating Example Here’s an example that illustrates the primary use case for std::span: In traditional C (or low-level C++), you’d pass an array to a function using a pointer and a size like this: