Template Function fmt::v6::arg(const S&, const T&)

Function Documentation

template<typename S, typename T, typename Char = char_t<S>>
internal::named_arg<T, Char> fmt::v6::arg(const S &name, const T &arg)

Returns a named argument to be used in a formatting function.

The named argument holds a reference and does not extend the lifetime of its arguments. Consequently, a dangling reference can accidentally be created. The user should take care to only pass this function temporaries when the named argument is itself a temporary, as per the following example.


fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23));