BloombergLP::bslfmt::format_to_n

Format args per fmtStr into out, writing at most maxNumChars.

Synopsis

Declared in <bslfmt_format_imp.h>

template<
    class t_OUT,
    class... t_ARGS>
format_to_n_result<t_OUT>
format_to_n(
    t_OUT out,
    bsl::iterator_traits<t_OUT>::difference_type maxNumChars,
    bslfmt::wformat_string<t_ARGS...> fmtStr,
    t_ARGS const&... args);

Description

Format the specified args according to the specification given by the specified fmtStr, and write at most the specified maxNumChars characters of the result of this operation into the output iterator referenced by the specified out parameter. Return a format_to_n_result object whose size member holds the number of characters that would have been written to out were such writing not truncated, and whose out member holds an iterator one past the end of the output range. In the event of an error the exception format_error is thrown. Behavior is undefined if out does not point to a valid output iterator.

Return Value

a format_to_n_result with the output iterator and untruncated size

Parameters

NameDescription
outoutput iterator receiving formatted characters
maxNumCharsmaximum number of characters to write
fmtStrwide format string
argsvalues to format