Skip to content

Commit

Permalink
Add an example to fmt::runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Aug 29, 2021
1 parent c1313c2 commit 1aaf72f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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}};
}
Expand Down

0 comments on commit 1aaf72f

Please sign in to comment.