From 09e8e09627cdbce4c4b54bbd9c6adbe17f6bfd0a Mon Sep 17 00:00:00 2001 From: Alexey Ochapov Date: Sat, 14 Nov 2020 22:21:46 +0300 Subject: [PATCH] apply code style, remove dumb FMT_CONSTEXPR20 usage explanation --- include/fmt/compile.h | 3 ++- include/fmt/format.h | 15 +++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/fmt/compile.h b/include/fmt/compile.h index c24a9a7a..2bfb202e 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -664,7 +664,8 @@ constexpr OutputIt format_to(OutputIt out, const CompiledFormat& cf, template ::value)> -FMT_CONSTEXPR14 OutputIt format_to(OutputIt out, const S&, const Args&... args) { +FMT_CONSTEXPR14 OutputIt format_to(OutputIt out, const S&, + const Args&... args) { constexpr auto compiled = detail::compile(S()); return format_to(out, compiled, args...); } diff --git a/include/fmt/format.h b/include/fmt/format.h index 4538ad73..bc146d16 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1148,7 +1148,7 @@ namespace detail { using data_digit_pair = char[2]; namespace compile_time_formatting_data { - constexpr data_digit_pair digits[] = FMT_DATA_DIGITS; +constexpr data_digit_pair digits[] = FMT_DATA_DIGITS; } // An equivalent of `*reinterpret_cast(&source)` that doesn't have @@ -1260,7 +1260,8 @@ inline buffer_appender reserve(buffer_appender it, size_t n) { return it; } -template inline constexpr Iterator& reserve(Iterator& it, size_t) { +template +inline constexpr Iterator& reserve(Iterator& it, size_t) { return it; } @@ -1462,10 +1463,10 @@ FMT_CONSTEXPR14 OutputIt copy_str(InputIt begin, InputIt end, OutputIt it) { return it; } -// FMT_CONSTEXPR20 used because of FMT_IS_CONSTANT_EVALUATED which depends on C++20 template ::value)> -inline FMT_CONSTEXPR20 OutChar* copy_str(InputIt begin, InputIt end, OutChar* out) { +inline FMT_CONSTEXPR20 OutChar* copy_str(InputIt begin, InputIt end, + OutChar* out) { if (FMT_IS_CONSTANT_EVALUATED) { return copy_str(begin, end, out); } @@ -1831,7 +1832,6 @@ template inline FMT_CONSTEXPR14 int count_digits_trivial(T n) { #if defined(FMT_BUILTIN_CLZLL) // Returns the number of decimal digits in n. Leading zeros are not counted // except for n == 0 in which case count_digits returns 1. -// FMT_CONSTEXPR20 used because of FMT_IS_CONSTANT_EVALUATED which depends on C++20 inline FMT_CONSTEXPR20 int count_digits(uint64_t n) { if (FMT_IS_CONSTANT_EVALUATED) { return count_digits_trivial(n); @@ -1886,7 +1886,6 @@ template <> int count_digits<4>(detail::fallback_uintptr n); #if defined(FMT_BUILTIN_CLZ) // Optional version of count_digits for better performance on 32-bit platforms. -// FMT_CONSTEXPR20 used because of FMT_IS_CONSTANT_EVALUATED which depends on C++20 inline FMT_CONSTEXPR20 int count_digits(uint32_t n) { if (FMT_IS_CONSTANT_EVALUATED) { return count_digits_trivial(n); @@ -1962,8 +1961,8 @@ template struct format_decimal_result { // enough. template inline FMT_CONSTEXPR20 format_decimal_result format_decimal(Char* out, - UInt value, - int size) { + UInt value, + int size) { FMT_ASSERT(size >= count_digits(value), "invalid digit count"); const data_digit_pair* digits; if (FMT_IS_CONSTANT_EVALUATED) {