Lightning Talk: C++ String Literals Have the Wrong Type
summary
String literals decay to arrays so std::ranges::size("abc") == 4 because the null terminator counts. The fix uses UDLs, NTTPs and TMP: a user defined literal returns a small compile time range type that stores pointer+length, implicitly converts to a C string, supports compile time concatenation without allocating memory, and produces correct begin/end where size is 3. It also supports different character types for UTF conversions and avoids instantiating storage until actually used.
AI-written summary · about
related talks
01h 36mEmbracing User-Defined Literals Safely
54mTypical C++, But Why?
03mLet's cmakeify the C++ standard library
51mThe C++ Type System is your Friend
59mRange-Based Text Formatting - For a Future Range-Based Standard Library
03mLightning Talk: C++ Catastrophes: A Poem
04mLightning Talk: Now in Our Lifetimes Cpp
01h 13mType safe C++ – LOL! :-)
