C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [Idea] Null-terminated string view (c_str_view / c_wstr_view) – a simpler alternative/complement to zstring_view

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Sat, 7 Feb 2026 08:40:38 +0100
So a reference std::string& Disadvantage is that you have to copy once at construction time of the std::string.   Would it make sense to have a class, acting like a reference or adaptor to an existing plain buffer, also storing the buffer size, also allowing modifications and with assumed NUL termination?   -----Ursprüngliche Nachricht----- Von:Thiago Macieira via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Sa 07.02.2026 03:01 Betreff:Re: [std-proposals] [Idea] Null-terminated string view (c_str_view / c_wstr_view) – a simpler alternative/complement to zstring_view Anlage:signature.asc An:std-proposals_at_[hidden]; CC:Thiago Macieira <thiago_at_[hidden]>; On Friday, 6 February 2026 17:51:13 Pacific Standard Time Henry Miller via Std- Proposals wrote: > Or perhaps we should open the bike-shed: do we want a _view here, or do we > want something only somewhat similar but that allows other operations. I'll repeat what I've said: that "something only somewhat similar" is std::string. It's NUL-terminated and modifiable. If some API inserts a NUL in the middle, that can be found via strlen and the string resized. -- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org  Principal Engineer - Intel Data Center - Platform & Sys. Eng. -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-02-07 07:57:27