From 469a4bbd356ab493ed0fc76ac45dc695fb2ba23a Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Tue, 4 Jun 2019 21:38:18 -0700 Subject: [PATCH] Use enable_if_t --- include/fmt/chrono.h | 7 +++---- include/fmt/format.h | 6 +++--- include/fmt/ostream.h | 10 ++++------ include/fmt/ranges.h | 7 ++----- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 46efc511..f75cd9b9 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -413,16 +413,15 @@ template struct make_unsigned_or_unchanged { }; template ::value, int>::type = 0> + FMT_ENABLE_IF(std::is_integral::value)> inline std::chrono::duration get_milliseconds( std::chrono::duration d) { auto s = std::chrono::duration_cast(d); return std::chrono::duration_cast(d - s); } -template < - typename Rep, typename Period, - typename std::enable_if::value, int>::type = 0> +template ::value)> inline std::chrono::duration get_milliseconds( std::chrono::duration d) { return std::chrono::duration( diff --git a/include/fmt/format.h b/include/fmt/format.h index fa0a473a..18bccaa3 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3047,9 +3047,9 @@ class format_int { // Formatter of objects of type T. template -struct formatter, T>::value>::type> { +struct formatter< + T, Char, + enable_if_t, T>::value>> { FMT_CONSTEXPR formatter() : format_str_(nullptr) {} // Parses format specifiers stopping either at the end of the range or at the diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index 4c2acf4a..e1b7e2b6 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -96,9 +96,8 @@ void format_value(buffer& buf, const T& value) { // Formats an object of type T that has an overloaded ostream operator<<. template -struct fallback_formatter< - T, Char, - typename std::enable_if::value>::type> +struct fallback_formatter::value>> : formatter, Char> { template auto format(const T& value, Context& ctx) -> decltype(ctx.out()) { @@ -113,9 +112,8 @@ struct fallback_formatter< // Disable conversion to int if T has an overloaded operator<< which is a free // function (not a member of std::ostream). template -struct convert_to_int< - T, Char, - typename std::enable_if::value>::type> { +struct convert_to_int::value>> { static const bool value = false; }; diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 18124d3a..9128f25a 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -194,9 +194,7 @@ template struct is_tuple_like { }; template -struct formatter< - TupleT, Char, - typename std::enable_if::value>::type> { +struct formatter::value>> { private: // C++11 generic lambda for format() template struct format_each { @@ -250,8 +248,7 @@ template struct is_range { }; template -struct formatter::value>::type> { +struct formatter::value>> { formatting_range formatting; template