Cleanup copy functions and move to base.h

This commit is contained in:
Victor Zverovich
2024-01-13 09:31:20 -08:00
parent 59baac522e
commit da0f84c42c
5 changed files with 83 additions and 88 deletions
+4 -4
View File
@@ -15,9 +15,9 @@
FMT_BEGIN_NAMESPACE
namespace detail {
template <typename Char, typename InputIt>
FMT_CONSTEXPR inline auto copy_str(InputIt begin, InputIt end,
counting_iterator it) -> counting_iterator {
template <typename T, typename InputIt>
FMT_CONSTEXPR inline auto copy(InputIt begin, InputIt end, counting_iterator it)
-> counting_iterator {
return it + (end - begin);
}
@@ -148,7 +148,7 @@ template <typename Char, typename T, int N> struct field {
const T& arg = get_arg_checked<T, N>(args...);
if constexpr (std::is_convertible_v<T, basic_string_view<Char>>) {
auto s = basic_string_view<Char>(arg);
return copy_str<Char>(s.begin(), s.end(), out);
return copy<Char>(s.begin(), s.end(), out);
}
return write<Char>(out, arg);
}