[#absl-FormatUntyped]
= xref:absl.adoc[absl]::FormatUntyped
:relfileprefix: ../
:mrdocs:

Writes a formatted string to an arbitrary sink object (implementing the `absl&colon;&colon;FormatRawSink` interface), using an `UntypedFormatSpec` and zero or more additional arguments&period;

== Synopsis

Declared in `&lt;absl&sol;strings&sol;str&lowbar;format&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
bool
FormatUntyped(
    xref:absl/FormatRawSink.adoc[FormatRawSink] raw&lowbar;sink,
    xref:absl/UntypedFormatSpec.adoc[UntypedFormatSpec] const& format,
    xref:absl/Span.adoc[absl::Span&lt;FormatArg const&gt;] args);
----

== Description

This function acts as the most generic formatting function in the `str&lowbar;format` library&period; The caller provides a raw sink, an unchecked format string, and (usually) a runtime specified list of arguments&semi; no compile&hyphen;time checking of formatting is performed within this function&period; As a result, a caller should check the return value to verify that no error occurred&period; On failure, this function returns `false` and the state of the sink is unspecified&period;

The arguments are provided in an `absl&colon;&colon;Span&lt;const absl&colon;&colon;FormatArg&gt;`&period; Each `absl&colon;&colon;FormatArg` object binds to a single argument and keeps a reference to it&period; The values used to create the `FormatArg` objects must outlive this function call&period;

Example&colon;

std&colon;&colon;optional&lt;std&colon;&colon;string&gt; FormatDynamic( const std&colon;&colon;string&amp; in&lowbar;format, const vector&lt;std&colon;&colon;string&gt;&amp; in&lowbar;args) &lcub; std&colon;&colon;string out&semi; std&colon;&colon;vector&lt;absl&colon;&colon;FormatArg&gt; args&semi; for (const auto&amp; v &colon; in&lowbar;args) &lcub; &sol;&sol; It is important that &apos;v&apos; is a reference to the objects in in&lowbar;args&period; &sol;&sol; The values we pass to FormatArg must outlive the call to &sol;&sol; FormatUntyped&period; args&period;emplace&lowbar;back(v)&semi; &rcub; absl&colon;&colon;UntypedFormatSpec format(in&lowbar;format)&semi; if (!absl&colon;&colon;FormatUntyped(&amp;out, format, args)) &lcub; return std&colon;&colon;nullopt&semi; &rcub; return std&colon;&colon;move(out)&semi; &rcub;

== Return Value

`true` on success, `false` on error&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *raw&lowbar;sink*
| The sink that receives the formatted output&period;
| *format*
| The untyped format spec&period;
| *args*
| The arguments substituted into the format string&period;
|===


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