mirror of
https://github.com/fmtlib/fmt.git
synced 2025-04-16 14:42:25 +00:00
Simplify fmt::runtime
This commit is contained in:
parent
d9c7166cf0
commit
156744ad47
@ -3080,10 +3080,8 @@ template <typename Char, typename... Args> class basic_format_string {
|
|||||||
|
|
||||||
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
|
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
|
||||||
// Workaround broken conversion on older gcc.
|
// Workaround broken conversion on older gcc.
|
||||||
template <typename... Args> using format_string = string_view;
|
template <typename...> using format_string = string_view;
|
||||||
template <typename S> auto runtime(const S& s) -> basic_string_view<char_t<S>> {
|
inline auto runtime(string_view s) -> basic_string_view<char> { return s; }
|
||||||
return 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>...>;
|
||||||
@ -3097,9 +3095,7 @@ using format_string = basic_format_string<char, type_identity_t<Args>...>;
|
|||||||
fmt::print(fmt::runtime("{:d}"), "I am not a number");
|
fmt::print(fmt::runtime("{:d}"), "I am not a number");
|
||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
template <typename S> auto runtime(const S& s) -> basic_runtime<char_t<S>> {
|
inline auto runtime(string_view s) -> basic_runtime<char> { return {{s}}; }
|
||||||
return {{s}};
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FMT_API auto vformat(string_view fmt, format_args args) -> std::string;
|
FMT_API auto vformat(string_view fmt, format_args args) -> std::string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user