forked from fmtlib/fmt
Minor cleanup
This commit is contained in:
@ -2925,12 +2925,12 @@ FMT_INLINE auto format_to_n(OutputIt out, size_t n, format_string<T...> fmt,
|
|||||||
return vformat_to_n(out, n, fmt, fmt::make_format_args(args...));
|
return vformat_to_n(out, n, fmt, fmt::make_format_args(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename OutputIt, typename OutputSen = OutputIt>
|
template <typename OutputIt, typename Sentinel = OutputIt>
|
||||||
struct format_to_result {
|
struct format_to_result {
|
||||||
/** Iterator pointing to just after the last succesful write in the range. */
|
/** Iterator pointing to just after the last succesful write in the range. */
|
||||||
OutputIt out;
|
OutputIt out;
|
||||||
/** Sentinel indicating the end of the output range. */
|
/** Sentinel indicating the end of the output range. */
|
||||||
OutputSen out_last;
|
Sentinel out_last;
|
||||||
|
|
||||||
FMT_CONSTEXPR operator OutputIt&() & noexcept { return out; }
|
FMT_CONSTEXPR operator OutputIt&() & noexcept { return out; }
|
||||||
FMT_CONSTEXPR operator const OutputIt&() const& noexcept { return out; }
|
FMT_CONSTEXPR operator const OutputIt&() const& noexcept { return out; }
|
||||||
@ -2939,16 +2939,15 @@ struct format_to_result {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <size_t Size>
|
template <size_t N>
|
||||||
auto vformat_to(char (&out)[Size], string_view fmt, format_args args)
|
auto vformat_to(char (&out)[N], string_view fmt, format_args args)
|
||||||
-> format_to_result<char*> {
|
-> format_to_result<char*> {
|
||||||
format_to_n_result<char*> result = vformat_to_n(out, Size, fmt, args);
|
return {vformat_to_n(out, N, fmt, args).out, out + N};
|
||||||
return {result.out, out + Size};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t Size, typename... T>
|
template <size_t N, typename... T>
|
||||||
FMT_INLINE auto format_to(char (&out)[Size], format_string<T...> fmt,
|
FMT_INLINE auto format_to(char (&out)[N], format_string<T...> fmt, T&&... args)
|
||||||
T&&... args) -> format_to_result<char*> {
|
-> format_to_result<char*> {
|
||||||
return vformat_to(out, fmt, fmt::make_format_args(args...));
|
return vformat_to(out, fmt, fmt::make_format_args(args...));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user