From 1aaf72fb6d7249cf1b86ea134585515a2a8a65b2 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 29 Aug 2021 12:10:40 -0700 Subject: [PATCH] Add an example to fmt::runtime --- include/fmt/core.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index ebf44702..05ee3806 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -2956,7 +2956,16 @@ template auto runtime(const S& s) -> basic_string_view> { #else template using format_string = basic_format_string...>; -/** 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 auto runtime(const S& s) -> basic_runtime> { return {{s}}; }