r/cpp • u/pavel_v • Apr 30 '26
C++26: string and string_view improvements
https://www.sandordargo.com/blog/2026/04/29/cpp26-string-string_view-improvements
70
Upvotes
r/cpp • u/pavel_v • Apr 30 '26
View all comments
Show parent comment
2
u/johannes1971 May 12 '26
How would you check if a string_view has a hidden zero-terminator without invoking UB? By definition, it's outside the buffer...
The issue with the null terminator potentially being removed is the exact same for every view type. I don't think it's worth agonizing over this particular case.
And I don't give a flying fuck about theoretical purity. We live in a world full of zero-terminated strings, there's absolutely nothing wrong with supporting that.