absl::StreamFormat

Writes to an output stream given a format string and zero or more arguments, generally in a manner that is more efficient than streaming the result of absl::StrFormat().

Synopsis

Declared in <absl/strings/str_format.h>

template<typename... Args>
[[nodiscard]]
str_format_internal::Streamable
StreamFormat(
    FormatSpec<Args...> const& format,
    Args const&... args);

Description

The returned object must be streamed before the full expression ends.

Example:

std::cout << StreamFormat("%12.6f", 3.14);

Return Value

A streamable object that writes the formatted output.

NOTE

The return value should not be discarded.

Parameters

NameDescription
formatThe format string.
argsThe arguments substituted into the format string.