From e5512c5d5762099b35c59a299e83add6b4c09e43 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 29 May 2019 13:21:24 -0700 Subject: [PATCH] Use static_assert instead of SFINAE in arg(...) --- include/fmt/core.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 0d1b5523..42839277 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1416,8 +1416,9 @@ typename buffer_context::type::iterator vformat_to( fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23)); \endrst */ -template ::value)> +template inline internal::named_arg arg(const S& name, const T& arg) { + static_assert(internal::is_string::value, ""); return {name, arg}; } @@ -1472,6 +1473,7 @@ inline std::basic_string vformat( std::string message = fmt::format("The answer is {}", 42); \endrst */ +// Use SFINAE instead of static_assert because of color overload of fmt::format. template ::value)> inline std::basic_string format(const S& format_str,