[#tinyformat-formatValue-05]
= xref:tinyformat.adoc[tinyformat]::formatValue
:relfileprefix: ../
:mrdocs:

Format a value into a stream, delegating to operator&lt;&lt; by default&period;

== Synopsis

Declared in `&lt;tinyformat&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename T&gt;
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&period; When this function is called, the stream flags will have been modified according to the format string&period; The format specification is provided in the range &lsqb;fmtBegin, fmtEnd)&period; For&rsqb; truncating conversions, ntrunc is set to the desired maximum number of characters, for example &quot;%&period;7s&quot; calls formatValue with ntrunc &equals; 7&period;

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *out*
| Stream to write the formatted value to&period;
| *fmtBegin*
| Pointer to the first character of the format specification&period;
| *fmtEnd*
| Pointer past the last character of the format specification&period;
| *ntrunc*
| Maximum number of characters to emit for truncating conversions, or negative for none&period;
| *value*
| Value to format&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
