namespace __format {
-template <class _Tp, class _CharT>
-requires(is_arithmetic_v<_Tp> &&
- !same_as<_Tp, bool>) struct _LIBCPP_HIDE_FROM_ABI
- __formatter_arithmetic {
- _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(_Tp __value, auto& __ctx) -> decltype(__ctx.out()) {
- return __handle_format(__value, __ctx);
- }
-
-private:
- template <class _Uv>
- _LIBCPP_HIDDEN static string
- __convert(_Uv __value) requires(same_as<_CharT, char>) {
- return _VSTD::to_string(__value);
- }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
- template <class _Uv>
- _LIBCPP_HIDDEN static wstring
- __convert(_Uv __value) requires(same_as<_CharT, wchar_t>) {
- return _VSTD::to_wstring(__value);
- }
-#endif
-
- template <class _Uv>
- _LIBCPP_HIDDEN auto __handle_format(_Uv __value, auto& __ctx)
- -> decltype(__ctx.out())
- {
- // TODO FMT Implement using formatting arguments
- // TODO FMT Improve PoC since using std::to_string is inefficient.
- // Note the code doesn't use std::string::iterator since the unit tests
- // test with debug iterators and they fail with strings created from
- // std::to_string.
- auto __str = __convert(__value);
- auto __out_it = __ctx.out();
- for (size_t __i = 0, __e = __str.size(); __i != __e; ++__i)
- *__out_it++ = __str[__i];
- return __out_it;
- }
-};
-} // namespace __format
-
-// These specializations are helper stubs and not proper formatters.
-// TODO FMT Implement the proper formatter specializations.
-
-// 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
-// removed since they are useful for developing the real versions.
-// Ultimately the stubs should be implemented properly and this code can be
-// removed.
-#if 0
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<float, _CharT>
- : public __format::__formatter_arithmetic<float, _CharT> {};
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT
- formatter<double, _CharT>
- : public __format::__formatter_arithmetic<double, _CharT> {};
-template <class _CharT>
-struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT
- formatter<long double, _CharT>
- : public __format::__formatter_arithmetic<long double, _CharT> {};
-#endif
-
-namespace __format {
-
template <class _CharT, class _ParseCtx, class _Ctx>
_LIBCPP_HIDE_FROM_ABI const _CharT*
__handle_replacement_field(const _CharT* __begin, const _CharT* __end,