diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 844793f4..9b205997 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -185,27 +185,6 @@ class prepared_format { prepared_format() = delete; - std::size_t formatted_size(const Args&... args) const { - const auto it = this->format_to(counting_iterator(), args...); - return it.count(); - } - - template ::value)> - inline format_to_n_result format_to_n(OutputIt out, unsigned n, - const Args&... args) const { - format_arg_store::type, - Args...> - as(args...); - - typedef truncating_iterator trunc_it; - typedef output_range range; - range r(trunc_it(out, n)); - auto it = this->vformat_to( - r, typename format_to_n_args::type(as)); - return {it.base(), it.count()}; - } - template ::value)> inline std::back_insert_iterator format_to( std::back_insert_iterator out, Args&&... args) const { @@ -723,6 +702,26 @@ std::basic_string format(const CompiledFormat& cf, const Args&... args) { return to_string(buffer); } +template ::value)> +format_to_n_result format_to_n(OutputIt out, unsigned n, + const CompiledFormat& cf, + const Args&... args) { + auto it = + cf.format_to(internal::truncating_iterator(out, n), args...) + .count(); + return {it.base(), it.count()}; +} + +template +std::size_t formatted_size(const CompiledFormat& cf, const Args&... args) { + return cf + .format_to( + internal::counting_iterator(), + args...) + .count(); +} + FMT_END_NAMESPACE #endif // FMT_COMPILE_H_