diff options
author | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-04-03 17:22:39 +0200 |
---|---|---|
committer | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-04-04 13:03:34 +0200 |
commit | 84d668b0ca67c5d3fe6430f101d61e60aa796a81 (patch) | |
tree | 5996a8e9dd51003ca00c2bd4ea536cdf203adfd6 /libcpp/expr.cc | |
parent | 42d6a4a985a6aa1c8c06daceb66e3408566a2e3a (diff) | |
download | gcc-84d668b0ca67c5d3fe6430f101d61e60aa796a81.zip gcc-84d668b0ca67c5d3fe6430f101d61e60aa796a81.tar.gz gcc-84d668b0ca67c5d3fe6430f101d61e60aa796a81.tar.bz2 |
libstdc++: Provide formatter for vector<bool>::reference [PR109162]
This patch implement formatter for vector<bool>::reference which
is part of P2286R8.
To indicate partial support we define __glibcxx_format_ranges macro
value 1, without defining __cpp_lib_format_ranges.
To avoid including the whole content of the <format> header, we
introduce new bits/formatfwd.h forward declares classes required
for newly introduce formatter.
The signatures of the user-facing parse and format method of the provided
formatters deviate from the standard by constraining types of params:
* _Bit_reference instead T satisfying is-vector-bool-reference<T>
* _CharT is constrained __formatter::__char
* basic_format_parse_context<_CharT> for parse argument
* basic_format_context<_Out, _CharT> for format second argument
The standard specifies last three of above as unconstrained types, which leads
to formattable<vector<bool>::reference, char32_t> (and any other type as char)
being true.
PR libstdc++/109162
libstdc++-v3/ChangeLog:
* include/Makefile.am: Add bits/formatfwd.h.
* include/Makefile.in: Add bits/formatfwd.h.
* include/bits/version.def: Define __glibcxx_format_ranges without
corresponding std name.
* include/bits/version.h: Regenerate.
* include/std/format (basic_format_context, __format::__char):
Move declartions to bits/formatfwd.h.
(formatter<_Tp, _CharT>): Remove default argument for _CharT
parameter, now specified in forward declaration in bits/formatfwd.h.
* include/std/vector (formatter<_Bit_reference, _CharT>): Define.
* include/bits/formatfwd.h: New file with forward declarations
for bits of std/format.
* testsuite/23_containers/vector/bool/format.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diffstat (limited to 'libcpp/expr.cc')
0 files changed, 0 insertions, 0 deletions