https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119970
--- Comment #6 from Tomasz KamiĆski <tkaminsk at gcc dot gnu.org> ---
Yes, this allows us to avoid a separate allocation when transcoding to valid
Unicode. For reference in libstdc++-v3/src/c++23/print.cc, to_valid_unicode
will edit sequence in-situ:
```
// If sizeof(_CharT) == 1 and the input is valid UTF-8, both s and out will
// be unchanged. Otherwise, each invalid sequence in s will be overwritten
// with a single 0xFF byte followed by zero or more 0xFE bytes, and then
// a valid UTF-8 string will be produced in out (replacing invalid
// sequences with U+FFFD).
template<typename _CharT>
bool
to_valid_unicode(span<char> s, basic_string<_CharT>& out)
```