c++ – Why there is no view similar to std::string_view

c++ – Why there is no view similar to std::string_view

There is a non-owning type for contiguous collections of arbitrary objects in C++20 called std::span.

Versions of C++ prior to C++20 can use the standalone implementation gsl::span.

std::span behaves similarly to C++17s std::string_view, but the interface provides general container-like access instead of string-like access, and the underlying data can be non-const. (From the table in the question, Element Mutability is Allowed.)

c++ – Why there is no view similar to std::string_view

Leave a Reply

Your email address will not be published. Required fields are marked *