fix formatted_size with "compiled format" as argument (#2161)
This commit is contained in:
+3
-3
@@ -1865,11 +1865,11 @@ inline auto format_to_n(OutputIt out, size_t n, const S& format_str,
|
||||
Returns the number of characters in the output of
|
||||
``format(format_str, args...)``.
|
||||
*/
|
||||
template <typename... Args>
|
||||
inline size_t formatted_size(string_view format_str, Args&&... args) {
|
||||
template <typename S, typename... Args, typename Char = char_t<S>>
|
||||
inline size_t formatted_size(const S& format_str, Args&&... args) {
|
||||
const auto& vargs = fmt::make_args_checked<Args...>(format_str, args...);
|
||||
detail::counting_buffer<> buf;
|
||||
detail::vformat_to(buf, format_str, vargs);
|
||||
detail::vformat_to(buf, to_string_view(format_str), vargs);
|
||||
return buf.count();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user