[libc++][format] Adds bool formatter.
Implements the formatter for Boolean types.
[format.formatter.spec]/2.3
For each charT, for each cv-unqualified arithmetic type ArithmeticT other
than char, wchar_t, char8_t, char16_t, or char32_t, a specialization
```
template<> struct formatter<ArithmeticT, charT>;
```
This removes the stub implemented in D96664.
Implements parts of:
- P0645 Text Formatting
- P1652 Printf corner cases in std::format
Completes:
- P1868 width: clarifying units of width and precision in std::format
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D103670
NOKEYCHECK=True
GitOrigin-RevId: 7fb9f99f3bb645337b4f4e6a2a3515219be82011
diff --git a/include/format b/include/format
index d4e24b6..9116015 100644
--- a/include/format
+++ b/include/format
@@ -279,6 +279,7 @@
#include <__format/format_parse_context.h>
#include <__format/format_string.h>
#include <__format/formatter.h>
+#include <__format/formatter_bool.h>
#include <__format/formatter_char.h>
#include <__format/formatter_integer.h>
#include <__format/formatter_string.h>
@@ -389,28 +390,6 @@
// These specializations are helper stubs and not proper formatters.
// TODO FMT Implement the proper formatter specializations.
-// [format.formatter.spec]/2.3
-// For each charT, for each cv-unqualified arithmetic type ArithmeticT other
-// than char, wchar_t, char8_t, char16_t, or char32_t, a specialization
-
-// Boolean.
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS formatter<bool, _CharT> {
- _LIBCPP_HIDE_FROM_ABI
- auto parse(auto& __parse_ctx) -> decltype(__parse_ctx.begin()) {
- // TODO FMT Implement
- return __parse_ctx.begin();
- }
-
- _LIBCPP_HIDE_FROM_ABI
- auto format(bool __b, auto& __ctx) -> decltype(__ctx.out()) {
- // TODO FMT Implement using formatting arguments
- auto __out_it = __ctx.out();
- *__out_it++ = _CharT('0') + __b;
- return __out_it;
- }
-};
-
// Floating point types.
// TODO FMT There are no replacements for the floating point stubs due to not
// having floating point support in std::to_chars yet. These stubs aren't