Date: Sun, 1 Feb 2026 20:24:05 +0100
So the actual string cannot be used as long as the substr is used?
That is dangerous and unexpected.
-----Ursprüngliche Nachricht-----
Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:So 01.02.2026 20:01
Betreff:Re: [std-proposals] [Idea] Null-terminated string view (c_str_view / c_wstr_view) – a simpler alternative/complement to zstring_view
An:std-proposals_at_[hidden];
CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>;
If I was gonna write a class along these lines, here's what I'd go for:
- In the constructor, take a pointer to a mutable null-terminated string
- In the 'substr' method, save the value of the one-past-the-last character and replace it with a null
- When the string is reset, place the one-past-the-last character back where it was
Of course this wouldn't be thread-safe, but it would be a nice efficient way to manipulate and re-use null-terminated strings.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2026-02-01 19:40:39
