mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-10 14:30:09 +00:00
Add an example to fmt::runtime
This commit is contained in:
parent
c1313c2057
commit
1aaf72fb6d
@ -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}};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user