diff options
author | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-06-06 12:24:11 +0200 |
---|---|---|
committer | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-06-13 08:37:01 +0200 |
commit | a651e3f3a6b4eb66185a9066c8cefe5288cda575 (patch) | |
tree | adfc222197d0e3f2ab431f4da01607836db3eef1 /libstdc++-v3/testsuite/std | |
parent | c550b5aff5227ff1298d43b060bbf3823559f383 (diff) | |
download | gcc-a651e3f3a6b4eb66185a9066c8cefe5288cda575.zip gcc-a651e3f3a6b4eb66185a9066c8cefe5288cda575.tar.gz gcc-a651e3f3a6b4eb66185a9066c8cefe5288cda575.tar.bz2 |
libstdc++: Rework formatting of empty chrono-spec for duration.
In contrast to other calendar types if empty chrono-spec is used for duration
we are required to format it (and its representation type) via ostream.
Handling this case was now moved to be part of the format function
for duration. To facilitate that __formatter_chrono::_M_format_to_ostream
function was made public.
However, for standard integral types, we know the result of inserting
them into ostream, and in consequence we can format them directly. This
is handled by configuring default format spec to "%Q%q" for such types.
As we no longer use __formatter_chrono::_M_format with empty chrono-spec,
this function now requires that _M_chrono_specs are not empty,
and conditional call to _M_format_to_ostream is removed. This allows
_M_format_to_ostream to be reduced to accept only duration.
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h (__formatter_chrono::_M_format):
Remove handling of empty _M_chrono_specs.
(__formatter_chrono::_M_format_to_ostream): Changed to accept
only chrono::duration and made public.
(std::formatter<chrono::duration<_Rep, _Period>, _CharT>):
Configure __defSpec and handle empty chrono-spec locally.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diffstat (limited to 'libstdc++-v3/testsuite/std')
0 files changed, 0 insertions, 0 deletions