aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/format
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-02-12 14:35:15 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-02-12 14:35:15 +0300
commit46a8b83899dd321edf511c0483f9c479ce2c1bc4 (patch)
treee5debc03beecbd10e7d1bf78c889c8d54e8c4523 /contrib/libs/cxxsupp/libcxx/include/format
parentb56bbcc9f63bf31991a8aa118555ce0c12875a74 (diff)
downloadydb-46a8b83899dd321edf511c0483f9c479ce2c1bc4.tar.gz
intermediate changes
ref:7c971b97c72bbbcbf889118d39017bd14f99365a
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/format')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/format81
1 files changed, 3 insertions, 78 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/format b/contrib/libs/cxxsupp/libcxx/include/format
index 19f642716b..53ecb5a43d 100644
--- a/contrib/libs/cxxsupp/libcxx/include/format
+++ b/contrib/libs/cxxsupp/libcxx/include/format
@@ -278,6 +278,7 @@ namespace std {
#include <__format/format_fwd.h>
#include <__format/format_parse_context.h>
#include <__format/format_string.h>
+#include <__format/format_to_n_result.h>
#include <__format/formatter.h>
#include <__format/formatter_bool.h>
#include <__format/formatter_char.h>
@@ -312,6 +313,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// to support compilers with partial C++20 support.
#if !defined(_LIBCPP_HAS_NO_CONCEPTS)
+// TODO FMT Move the implementation in this file to its own granular headers.
+
// TODO FMT Evaluate which templates should be external templates. This
// improves the efficiency of the header. However since the header is still
// under heavy development and not all classes are stable it makes no sense
@@ -347,78 +350,6 @@ make_wformat_args(const _Args&... __args) {
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,
@@ -579,12 +510,6 @@ format(wstring_view __fmt, const _Args&... __args) {
}
#endif
-template <class _OutIt>
-struct _LIBCPP_TEMPLATE_VIS format_to_n_result {
- _OutIt out;
- iter_difference_t<_OutIt> size;
-};
-
template <output_iterator<const char&> _OutIt, class... _Args>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt>
format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, string_view __fmt,