From 8da7a17a66334c4f7ec36e28df6c209e39f2da67 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 8 Jul 2021 19:04:11 +0200 Subject: [PATCH] Fix compilation --- Source/ThirdParty/fmt/core.h | 2 +- Source/ThirdParty/fmt/format-inl.h | 1 + Source/ThirdParty/fmt/format.h | 99 ++++-------------------------- 3 files changed, 13 insertions(+), 89 deletions(-) diff --git a/Source/ThirdParty/fmt/core.h b/Source/ThirdParty/fmt/core.h index d26afce05..93ecb910e 100644 --- a/Source/ThirdParty/fmt/core.h +++ b/Source/ThirdParty/fmt/core.h @@ -1550,7 +1550,7 @@ template struct named_arg_base { template basic_format_arg deserialize() const { basic_format_arg arg; - std::memcpy(&arg, data, sizeof(basic_format_arg)); + ::memcpy(&arg, data, sizeof(basic_format_arg)); return arg; } }; diff --git a/Source/ThirdParty/fmt/format-inl.h b/Source/ThirdParty/fmt/format-inl.h index edc606ea3..c763a0e46 100644 --- a/Source/ThirdParty/fmt/format-inl.h +++ b/Source/ThirdParty/fmt/format-inl.h @@ -10,6 +10,7 @@ #include "format.h" +#include #include #include #include diff --git a/Source/ThirdParty/fmt/format.h b/Source/ThirdParty/fmt/format.h index b20d6f214..b2cb88a24 100644 --- a/Source/ThirdParty/fmt/format.h +++ b/Source/ThirdParty/fmt/format.h @@ -1106,14 +1106,14 @@ template class float_writer { if (num_digits_ > 1 || specs_.showpoint) *it++ = decimal_point_; it = copy_str(digits_ + 1, digits_ + num_digits_, it); if (num_zeros > 0 && specs_.showpoint) - it = std::fill_n(it, num_zeros, static_cast('0')); + it = internal::fill_n(it, num_zeros, static_cast('0')); *it++ = static_cast(specs_.upper ? 'E' : 'e'); return write_exponent(full_exp - 1, it); } if (num_digits_ <= full_exp) { // 1234e7 -> 12340000000[.0+] it = copy_str(digits_, digits_ + num_digits_, it); - it = std::fill_n(it, full_exp - num_digits_, static_cast('0')); + it = internal::fill_n(it, full_exp - num_digits_, static_cast('0')); if (specs_.showpoint || specs_.precision < 0) { *it++ = decimal_point_; int num_zeros = specs_.precision - full_exp; @@ -1126,7 +1126,7 @@ template class float_writer { if (num_zeros > 1000) throw std::runtime_error("fuzz mode - avoiding excessive cpu use"); #endif - it = std::fill_n(it, num_zeros, static_cast('0')); + it = internal::fill_n(it, num_zeros, static_cast('0')); } } else if (full_exp > 0) { // 1234e-2 -> 12.34[0+] @@ -1144,7 +1144,7 @@ template class float_writer { if (specs_.precision > num_digits_) { // Add trailing zeros. int num_zeros = specs_.precision - num_digits_; - it = std::fill_n(it, num_zeros, static_cast('0')); + it = internal::fill_n(it, num_zeros, static_cast('0')); } } else { // 1234e-6 -> 0.001234 @@ -1160,7 +1160,7 @@ template class float_writer { while (num_digits > 0 && digits_[num_digits - 1] == '0') --num_digits; if (num_zeros != 0 || num_digits != 0 || specs_.showpoint) { *it++ = decimal_point_; - it = std::fill_n(it, num_zeros, static_cast('0')); + it = internal::fill_n(it, num_zeros, static_cast('0')); it = copy_str(digits_, digits_ + num_digits, it); } } @@ -1389,8 +1389,8 @@ template struct nonfinite_writer { template FMT_NOINLINE OutputIt fill(OutputIt it, size_t n, const fill_t& fill) { auto fill_size = fill.size(); - if (fill_size == 1) return std::fill_n(it, n, fill[0]); - for (size_t i = 0; i < n; ++i) it = std::copy_n(fill.data(), fill_size, it); + if (fill_size == 1) return internal::fill_n(it, n, fill[0]); + for (size_t i = 0; i < n; ++i) it = internal::copy_n(fill.data(), fill_size, it); return it; } @@ -1425,7 +1425,7 @@ template class basic_writer { template void operator()(It&& it) const { if (prefix.size() != 0) it = copy_str(prefix.begin(), prefix.end(), it); - it = std::fill_n(it, padding, fill); + it = internal::fill_n(it, padding, fill); f(it); } }; @@ -1789,7 +1789,7 @@ template class basic_writer { void write(wstring_view value) { static_assert(std::is_same::value, ""); auto&& it = reserve(value.size()); - it = std::copy(value.begin(), value.end(), it); + it = internal::copy(value.begin(), value.end(), it); } template @@ -2549,7 +2549,7 @@ template <> inline bool find(const char* first, const char* last, char value, const char*& out) { out = static_cast( - std::memchr(first, value, internal::to_unsigned(last - first))); + ::memchr(first, value, internal::to_unsigned(last - first))); return out != nullptr; } @@ -2718,12 +2718,6 @@ void handle_dynamic_spec(int& value, arg_ref ref, } } // namespace internal -template -using basic_writer FMT_DEPRECATED_ALIAS = internal::basic_writer; -using writer FMT_DEPRECATED_ALIAS = internal::writer; -using wwriter FMT_DEPRECATED_ALIAS = - internal::basic_writer>; - /** The default argument formatter. */ template class arg_formatter : public internal::arg_formatter_base { @@ -3071,7 +3065,7 @@ struct format_handler : internal::error_handler { auto size = internal::to_unsigned(end - begin); auto out = context.out(); auto&& it = internal::reserve(out, size); - it = std::copy_n(begin, size, it); + it = internal::copy_n(begin, size, it); context.advance_to(out); } @@ -3172,77 +3166,6 @@ template <> struct formatter { internal::dynamic_format_specs specs_; }; -template struct arg_join : internal::view { - It begin; - It end; - basic_string_view sep; - - arg_join(It b, It e, basic_string_view s) : begin(b), end(e), sep(s) {} -}; - -template -struct formatter, Char> - : formatter::value_type, Char> { - template - auto format(const arg_join& value, FormatContext& ctx) - -> decltype(ctx.out()) { - using base = formatter::value_type, Char>; - auto it = value.begin; - auto out = ctx.out(); - if (it != value.end) { - out = base::format(*it++, ctx); - while (it != value.end) { - out = std::copy(value.sep.begin(), value.sep.end(), out); - ctx.advance_to(out); - out = base::format(*it++, ctx); - } - } - return out; - } -}; - -/** - Returns an object that formats the iterator range `[begin, end)` with elements - separated by `sep`. - */ -template -arg_join join(It begin, It end, string_view sep) { - return {begin, end, sep}; -} - -template -arg_join join(It begin, It end, wstring_view sep) { - return {begin, end, sep}; -} - -/** - \rst - Returns an object that formats `range` with elements separated by `sep`. - - **Example**:: - - std::vector v = {1, 2, 3}; - fmt::print("{}", fmt::join(v, ", ")); - // Output: "1, 2, 3" - - ``fmt::join`` applies passed format specifiers to the range elements:: - - fmt::print("{:02}", fmt::join(v, ", ")); - // Output: "01, 02, 03" - \endrst - */ -template -arg_join, char> join(const Range& range, - string_view sep) { - return join(std::begin(range), std::end(range), sep); -} - -template -arg_join, wchar_t> join(const Range& range, - wstring_view sep) { - return join(std::begin(range), std::end(range), sep); -} - #if FMT_USE_STRING /** \rst