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

--- Comment #23 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Tomasz Kamiński from comment #22)
> > That is highly intentional to fix incorrect formatting when the container 
> > is a string. See https://cplusplus.github.io/LWG/issue3881
> 
> I am well aware of this quirk, but my implementation uses
> range_formatter<char> in this case, and also produce sequence of characters,
> instead of string presentation.
> See corresponding test case:
> ```
> // Sequence output is always used
> std::queue<_CharT, std::basic_string<_CharT>> qs(
>           std::from_range,
>           std::basic_string_view<_CharT>(WIDEN("321")));
>       
>         res = std::format(WIDEN("{}"), qs);
>         VERIFY( res == WIDEN("['3', '2', '1']") );
> ```
> 
> So I still see no reason to using formatter<ref_view<R>> over
> range_formatter.

Yep, it seems like the libstdc++'s resolution is simpler than the LWG 3881.
Kudos to you. It's tremendous great that libstdc++ finally supports formatting
ranges.
Although it doesn't seem to be in the upcoming GCC-15 release.

Reply via email to