Commit e5512c5d authored by Victor Zverovich's avatar Victor Zverovich

Use static_assert instead of SFINAE in arg(...)

parent afc571ae
...@@ -1416,8 +1416,9 @@ typename buffer_context<Char>::type::iterator vformat_to( ...@@ -1416,8 +1416,9 @@ typename buffer_context<Char>::type::iterator vformat_to(
fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23)); fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23));
\endrst \endrst
*/ */
template <typename S, typename T, FMT_ENABLE_IF(internal::is_string<S>::value)> template <typename S, typename T>
inline internal::named_arg<T, FMT_CHAR(S)> arg(const S& name, const T& arg) { inline internal::named_arg<T, FMT_CHAR(S)> arg(const S& name, const T& arg) {
static_assert(internal::is_string<S>::value, "");
return {name, arg}; return {name, arg};
} }
...@@ -1472,6 +1473,7 @@ inline std::basic_string<Char> vformat( ...@@ -1472,6 +1473,7 @@ inline std::basic_string<Char> vformat(
std::string message = fmt::format("The answer is {}", 42); std::string message = fmt::format("The answer is {}", 42);
\endrst \endrst
*/ */
// Use SFINAE instead of static_assert because of color overload of fmt::format.
template <typename S, typename... Args, template <typename S, typename... Args,
FMT_ENABLE_IF(internal::is_string<S>::value)> FMT_ENABLE_IF(internal::is_string<S>::value)>
inline std::basic_string<FMT_CHAR(S)> format(const S& format_str, inline std::basic_string<FMT_CHAR(S)> format(const S& format_str,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment