string_view
summary
string_view is a Library Fundamentals TS class that models a constant contiguous character sequence as a non-owning pointer+length (four char-type specializations), with cheap constructors from pointer+length or std::string (implicit) and one that traverses a C string to find length. It removes temporary std::string allocations so simple parsing examples go from multiple allocations and copies to no heap allocations, supports remove_prefix/remove_suffix, but gives no null termination and forces caller-managed lifetimes and thread-safety.
AI-written summary · about
chapters (11)
- 0:00Introduction to string_view
- 1:28What is string_view
- 9:10How string_view works
- 16:19When to use string_view
- 23:48Performance benefits of string_view
- 33:38Migrating to string_view
- 40:59Constructing string_view
- 48:02String_view limitations
- 51:01Lifetime management concerns
- 55:43String_view in practice
- 1:01:19Where to get string_view
related talks
01h 02mA Short Life span<> For a Regular Mess - std::span
01h 11mI just wanted to point to something!
59mStrongly Typed Containers
31mThe strange details of std::string at Facebook
01h 02mWriting Standard Library Compliant Data Structures and Algorithms
32mC++ Standard Library "Little Things”
58mModern C++ Design (part 2 of 2)
01h 31mThe C++ Vector Challenge
