fmt::format_to_n

format_to_n overloads

Synopses

Declared in <fmt/base.h>

Formats args according to specifications in fmt, writes up to n characters of the result to the output iterator out and returns the total (not truncated) output size and the iterator past the end of the output range. format_to_n does not append a terminating null character.

template<
    typename OutputIt,
    typename... T>
format_to_n_result<OutputIt>
format_to_n(
    OutputIt out,
    size_t n,
    format_string<T...> fmt,
    T&&... args);
» more...

Formats args according to specifications in fmt, writes up to n characters of the result to the output iterator out and returns the total (not truncated) output size and the iterator past the end of the output range.

template<
    typename OutputIt,
    typename... T>
format_to_n_result<OutputIt>
format_to_n(
    OutputIt out,
    size_t n,
    wformat_string<T...> fmt,
    T&&... args);
» more...

Formats args according to the compiled format string fmt and writes at most n characters to the output iterator out.

template<
    typename OutputIt,
    typename S,
    typename... T>
format_to_n_result<OutputIt>
format_to_n(
    OutputIt out,
    size_t n,
    S const& fmt,
    T&&... args);
» more...

Formats args according to specifications in fmt, with an exotic (non-char, non-wchar_t) character type, writes up to n characters of the result to the output iterator out and returns the total (not truncated) output size and the iterator past the end of the output range.

template<
    typename OutputIt,
    typename S,
    typename... T,
    typename Char = /* implementation-defined */>
format_to_n_result<OutputIt>
format_to_n(
    OutputIt out,
    size_t n,
    S const& fmt,
    T&&... args);
» more...

Return Value

  • The total (not truncated) output size and the iterator past the end of the output range.
  • The total (not truncated) output size and the iterator past the end of the output range.
  • The output iterator past the end of the output written and the total (untruncated) output size.

Parameters

NameDescription
outThe output iterator to write to.
nThe maximum number of characters to write.
fmtThe format string.
argsThe arguments to format.