Add an example to fmt::runtime

This commit is contained in:
Victor Zverovich 2021-08-29 12:10:40 -07:00
parent c1313c2057
commit 1aaf72fb6d

View File

@ -2956,7 +2956,16 @@ template <typename S> auto runtime(const S& s) -> basic_string_view<char_t<S>> {
#else
template <typename... Args>
using format_string = basic_format_string<char, type_identity_t<Args>...>;
/** Creates a runtime format string. */
/**
\rst
Creates a runtime format string.
**Example**::
// Check format string at runtime instead of compile-time.
fmt::print(fmt::runtime("{:d}"), "I am not a number");
\endrst
*/
template <typename S> auto runtime(const S& s) -> basic_runtime<char_t<S>> {
return {{s}};
}