Test and fix compiled format_to_n and formatted_size

This commit is contained in:
Victor Zverovich
2019-08-25 06:38:41 -07:00
parent 4070c1d80b
commit a5f470eb10
2 changed files with 16 additions and 14 deletions

View File

@@ -553,16 +553,15 @@ format_to_n_result<OutputIt> format_to_n(OutputIt out, size_t n,
const CompiledFormat& cf,
const Args&... args) {
auto it =
cf.format_to(internal::truncating_iterator<OutputIt>(out, n), args...);
format_to(internal::truncating_iterator<OutputIt>(out, n), cf, args...);
return {it.base(), it.count()};
}
template <typename CompiledFormat, typename... Args>
std::size_t formatted_size(const CompiledFormat& cf, const Args&... args) {
return cf
.format_to(
internal::counting_iterator<typename CompiledFormat::char_type>(),
args...)
return fmt::format_to(
internal::counting_iterator<typename CompiledFormat::char_type>(),
cf, args...)
.count();
}