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
1
u/Zeh_Matt No, no, no, no May 12 '26
I never said anything about checking string_views for null terminator, what I suggested is a function that constructs you a string_view ONLY if the input contains a null terminator and otherwise throw. If you are asking for some new type then you should be able to at least specify the semantics of it, "just give us cstring_view" doesn't work in reality. Also we seem to be living in vastly different worlds, I never have to really care about the null terminator and if some API expects it I just temporarily construct std::string when its passing a view, don't have to over engineer this.