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@lists.isocpp.org>
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@lists.isocpp.org;
CC: Thiago Macieira <thiago@macieira.org>;
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@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals