Daily bit(e) of C++ | std::string_view
Daily bit(e) of C++ #257, The borrowed range for strings: std::string_view.
The std::string_view is a borrowed range that can reference any (not necessarily null-terminated) string, i.e. string literals, std::string and other character contiguous ranges.
std::string_view should be preferred over an immutable std::string, except for cases when ownership is also required, as std::string_view can only reference data owned by other ranges.
Thanks for reading Daily bit(e) of C++! Subscribe for free to receive new posts and support my work.