https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111052

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-08-17
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Alternatively, we could add a special case to ranges::copy so that copying a
range to a back_insert_iterator<string> uses string::append instead of writing
one element at a time.

That would benefit more than just std::format_to. But we might still want to do
extract a back_insert_iterator<string>'s string into a _Seq_sink<string>,
because that would allow us to write directly to the string instead of
buffering and then copying to it on overflow.

We should also make ranges::copy implement the std::copy optimization for
copying to ostreambuf_iterator, which is an important performance enhancement.
That will benefit:

std::format_to(std::ostreambuf_iterator<char>(std::cout), "");

The _Iter_sink<_CharT, _Iter> could recognise an ostreambuf_iterator and use
std::copy, but we should really just make ranges::copy do those optimizations.

Reply via email to