tinyformat::formatValue

Format a value into a stream, delegating to operator<< by default.

Synopsis

Declared in <tinyformat.h>

template<typename T>
void
formatValue(
    std::ostream& out,
    char const* fmtBegin,
    char const* fmtEnd,
    int ntrunc,
    T const& value);

Description

Users may override this for their own types. When this function is called, the stream flags will have been modified according to the format string. The format specification is provided in the range [fmtBegin, fmtEnd). For] truncating conversions, ntrunc is set to the desired maximum number of characters, for example "%.7s" calls formatValue with ntrunc = 7.

By default, formatValue() uses the usual stream insertion operator operator<< to format the type T, with special cases for the %c and %p conversions.

Parameters

NameDescription
outStream to write the formatted value to.
fmtBeginPointer to the first character of the format specification.
fmtEndPointer past the last character of the format specification.
ntruncMaximum number of characters to emit for truncating conversions, or negative for none.
valueValue to format.