Document format_to_n

This commit is contained in:
Victor Zverovich 2018-03-30 08:31:41 -10:00
parent 3cf0526316
commit c5ebecf7c6
2 changed files with 13 additions and 1 deletions

View File

@ -135,6 +135,9 @@ Output iterator support
-----------------------
.. doxygenfunction:: fmt::format_to(OutputIt, string_view, const Args&...)
.. doxygenfunction:: fmt::format_to_n(OutputIt, size_t string_view, const Args&...)
.. doxygenstruct:: fmt::format_to_n_result
:members:
Literal-based API
-----------------

View File

@ -3256,7 +3256,7 @@ struct format_handler : internal::error_handler {
basic_arg<Context> arg;
};
/** Formats arguments and writes the output to the buffer. */
/** Formats arguments and writes the output to the range. */
template <typename ArgFormatter, typename Char, typename Context>
typename Context::iterator vformat_to(typename ArgFormatter::range out,
basic_string_view<Char> format_str,
@ -3419,10 +3419,19 @@ inline typename std::enable_if<
template <typename OutputIt>
struct format_to_n_result {
/** Iterator past the end of the output range. */
OutputIt out;
/** Total (not truncated) output size. */
std::size_t size;
};
/**
\rst
Formats arguments, writes up to ``n`` characters of the result to the output
iterator ``out`` and returns the total output size and the iterator past the end
of the output range.
\endrst
*/
template <typename OutputIt, typename... Args>
inline format_to_n_result<OutputIt> format_to_n(
OutputIt out, std::size_t n, string_view format_str, const Args & ... args) {