Fix buffer<T>::append not found
This commit is contained in:
parent
11c3634d6f
commit
5dca745a49
@ -504,7 +504,7 @@ FMT_BEGIN_EXPORT
|
|||||||
template <typename CompiledFormat, typename... Args,
|
template <typename CompiledFormat, typename... Args,
|
||||||
typename Char = typename CompiledFormat::char_type,
|
typename Char = typename CompiledFormat::char_type,
|
||||||
FMT_ENABLE_IF(detail::is_compiled_format<CompiledFormat>::value)>
|
FMT_ENABLE_IF(detail::is_compiled_format<CompiledFormat>::value)>
|
||||||
FMT_CONSTEXPR20 FMT_INLINE std::basic_string<Char> format(
|
FMT_CONSTEXPR_LIB FMT_INLINE std::basic_string<Char> format(
|
||||||
const CompiledFormat& cf, const Args&... args) {
|
const CompiledFormat& cf, const Args&... args) {
|
||||||
auto s = std::basic_string<Char>();
|
auto s = std::basic_string<Char>();
|
||||||
cf.format(std::back_inserter(s), args...);
|
cf.format(std::back_inserter(s), args...);
|
||||||
@ -520,7 +520,7 @@ constexpr FMT_INLINE OutputIt format_to(OutputIt out, const CompiledFormat& cf,
|
|||||||
|
|
||||||
template <typename S, typename... Args,
|
template <typename S, typename... Args,
|
||||||
FMT_ENABLE_IF(detail::is_compiled_string<S>::value)>
|
FMT_ENABLE_IF(detail::is_compiled_string<S>::value)>
|
||||||
FMT_INLINE FMT_CONSTEXPR20 std::basic_string<typename S::char_type> format(
|
FMT_INLINE FMT_CONSTEXPR_LIB std::basic_string<typename S::char_type> format(
|
||||||
const S&, Args&&... args) {
|
const S&, Args&&... args) {
|
||||||
if constexpr (std::is_same<typename S::char_type, char>::value) {
|
if constexpr (std::is_same<typename S::char_type, char>::value) {
|
||||||
constexpr auto str = basic_string_view<typename S::char_type>(S());
|
constexpr auto str = basic_string_view<typename S::char_type>(S());
|
||||||
|
|||||||
@ -792,7 +792,7 @@ FMT_MODULE_EXPORT template <typename Context> class basic_format_args;
|
|||||||
FMT_MODULE_EXPORT template <typename Context> class dynamic_format_arg_store;
|
FMT_MODULE_EXPORT template <typename Context> class dynamic_format_arg_store;
|
||||||
|
|
||||||
// A formatter for objects of type T.
|
// A formatter for objects of type T.
|
||||||
FMT_MODULE_EXPORT
|
FMT_MODULE_EXPORT
|
||||||
template <typename T, typename Char = char, typename Enable = void>
|
template <typename T, typename Char = char, typename Enable = void>
|
||||||
struct formatter {
|
struct formatter {
|
||||||
// A deleted default constructor indicates a disabled formatter.
|
// A deleted default constructor indicates a disabled formatter.
|
||||||
@ -941,7 +941,18 @@ template <typename T> class buffer {
|
|||||||
|
|
||||||
/** Appends data to the end of the buffer. */
|
/** Appends data to the end of the buffer. */
|
||||||
template <typename U>
|
template <typename U>
|
||||||
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 <typename Idx> FMT_CONSTEXPR auto operator[](Idx index) -> T& {
|
template <typename Idx> FMT_CONSTEXPR auto operator[](Idx index) -> T& {
|
||||||
return ptr_[index];
|
return ptr_[index];
|
||||||
|
|||||||
@ -875,21 +875,6 @@ using is_double_double = bool_constant<std::numeric_limits<T>::digits == 106>;
|
|||||||
# define FMT_USE_FULL_CACHE_DRAGONBOX 0
|
# define FMT_USE_FULL_CACHE_DRAGONBOX 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
template <typename U>
|
|
||||||
FMT_CONSTEXPR void buffer<T>::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 <typename T, typename Enable = void>
|
template <typename T, typename Enable = void>
|
||||||
struct is_locale : std::false_type {};
|
struct is_locale : std::false_type {};
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user