10
Advanced Container View Usage
At their core, views are non-owning ranges, meaning they provide a view (hence the name) of other data structures without taking ownership of the underlying data. This makes them incredibly lightweight and versatile. With views, you can perform various operations on data without copying it, ensuring efficient code that maximizes performance and minimizes overhead.
This chapter focuses on the following containers:
- std::span
- std::mdspan
Technical requirements
The code in this chapter can be found on GitHub:
https://github.com/PacktPublishing/Data-Structures-and-Algorithms-with-the-CPP-STL
std::span
std::span is a template class introduced in C++20 that provides a view of a contiguous sequence of elements, similar ...
Get Data Structures and Algorithms with the C++ STL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.