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
|
#else
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
using format_string = basic_format_string<char, type_identity_t<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>> {
|
template <typename S> auto runtime(const S& s) -> basic_runtime<char_t<S>> {
|
||||||
return {{s}};
|
return {{s}};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user