From 5dca745a49798246426c7a5a5097bf6ef02accf9 Mon Sep 17 00:00:00 2001 From: Shawn Zhong Date: Sat, 29 Apr 2023 05:36:54 -0500 Subject: [PATCH] Fix `buffer::append` not found --- include/fmt/compile.h | 4 ++-- include/fmt/core.h | 15 +++++++++++++-- include/fmt/format.h | 15 --------------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/include/fmt/compile.h b/include/fmt/compile.h index aa91745b..d58eba0b 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -504,7 +504,7 @@ FMT_BEGIN_EXPORT template ::value)> -FMT_CONSTEXPR20 FMT_INLINE std::basic_string format( +FMT_CONSTEXPR_LIB FMT_INLINE std::basic_string format( const CompiledFormat& cf, const Args&... args) { auto s = std::basic_string(); cf.format(std::back_inserter(s), args...); @@ -520,7 +520,7 @@ constexpr FMT_INLINE OutputIt format_to(OutputIt out, const CompiledFormat& cf, template ::value)> -FMT_INLINE FMT_CONSTEXPR20 std::basic_string format( +FMT_INLINE FMT_CONSTEXPR_LIB std::basic_string format( const S&, Args&&... args) { if constexpr (std::is_same::value) { constexpr auto str = basic_string_view(S()); diff --git a/include/fmt/core.h b/include/fmt/core.h index 3f30c1da..43efa115 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -792,7 +792,7 @@ FMT_MODULE_EXPORT template class basic_format_args; FMT_MODULE_EXPORT template class dynamic_format_arg_store; // A formatter for objects of type T. -FMT_MODULE_EXPORT +FMT_MODULE_EXPORT template struct formatter { // A deleted default constructor indicates a disabled formatter. @@ -941,7 +941,18 @@ template class buffer { /** Appends data to the end of the buffer. */ template - void FMT_CONSTEXPR append(const U* begin, const U* end); + FMT_CONSTEXPR void append(const U* begin, const U* end) { + while (begin != end) { + auto count = to_unsigned(end - begin); + try_reserve(size_ + count); + auto free_cap = capacity_ - size_; + if (free_cap < count) count = free_cap; + auto out = make_checked(ptr_ + size_, count); + for (size_t i = 0; i < count; ++i) *out++ = begin[i]; + size_ += count; + begin += count; + } + } template FMT_CONSTEXPR auto operator[](Idx index) -> T& { return ptr_[index]; diff --git a/include/fmt/format.h b/include/fmt/format.h index 81265dcc..8a5f36a4 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -875,21 +875,6 @@ using is_double_double = bool_constant::digits == 106>; # define FMT_USE_FULL_CACHE_DRAGONBOX 0 #endif -template -template -FMT_CONSTEXPR void buffer::append(const U* begin, const U* end) { - while (begin != end) { - auto count = to_unsigned(end - begin); - try_reserve(size_ + count); - auto free_cap = capacity_ - size_; - if (free_cap < count) count = free_cap; - auto out = make_checked(ptr_ + size_, count); - for (size_t i = 0; i < count; ++i) *out++ = begin[i]; - size_ += count; - begin += count; - } -} - template struct is_locale : std::false_type {}; template