StringViews, StringViews everywhere!
summary
Explains why std::string_view and QStringView make non-owning string APIs practical, shows concrete code that replaces std::string params to avoid heap allocations and how to implement heterogeneous lookup for unordered maps so lookups of literals and string_views are no allocations. Demonstrates node extraction to fix SSO-related pointer issues, delegates member calls to free functions for register passing, documents lifetime pitfalls when returning views, and reports partial Qt 5.10 rollout with measurable allocation savings in XML entity lookup.
AI-written summary · about
chapters (12)
- 0:00Start
- 4:02string_view as an interface Type
- 12:00Heterogeneous Associative Container Lookup
- 14:14Ordered STL containers have heterogeneous lookup
- 15:45Can we do better?
- 30:08Marrying Member Functions and Free Functions
- 33:06but need to mirror std::string API!
- 35:36Contracts && String-Views
- 40:08What about "valid parameter values"?
- 45:58Where's the difference?
- 47:00What if you could check (ptr, len) is a valid range?
- 48:18Thank you for your attention! Questions?








