diff --git a/fmt/format.h b/fmt/format.h index 06ccd1fc..e190d2e3 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -819,12 +819,6 @@ class char_traits : public basic_char_traits { const wchar_t *format, unsigned width, int precision, T value); }; -template -struct enable_if {}; - -template -struct enable_if { typedef T type; }; - template struct conditional { typedef T type; }; @@ -937,12 +931,12 @@ const Char *pointer_from(null_terminating_iterator it) { // Returns true if value is negative, false otherwise. // Same as (value < 0) but doesn't produce warnings if T is an unsigned type. template -inline typename enable_if::is_signed, bool>::type +inline typename std::enable_if::is_signed, bool>::type is_negative(T value) { return value < 0; } template -inline typename enable_if::is_signed, bool>::type +inline typename std::enable_if::is_signed, bool>::type is_negative(T) { return false; } @@ -1425,7 +1419,7 @@ class value { template value(const T &value, - typename enable_if::value, int>::type = 0) { + typename std::enable_if::value, int>::type = 0) { static_assert(internal::type() == internal::CUSTOM, "invalid type"); this->custom.value = &value; this->custom.format = &format_custom_arg; @@ -1433,7 +1427,7 @@ class value { template value(const T &value, - typename enable_if::value, int>::type = 0) { + typename std::enable_if::value, int>::type = 0) { static_assert(internal::type() == internal::INT, "invalid type"); this->int_value = value; } @@ -1931,7 +1925,7 @@ class arg_formatter_base { } template - typename enable_if< + typename std::enable_if< std::is_same::value && std::is_same::value>::type write_str(basic_string_view value) { @@ -1939,7 +1933,7 @@ class arg_formatter_base { } template - typename enable_if< + typename std::enable_if< !std::is_same::value || !std::is_same::value>::type write_str(basic_string_view ) { @@ -3564,7 +3558,8 @@ struct format_enum : std::integral_constant::value> {}; // Formatter of objects of type T. template -struct formatter::value>::type> { +struct formatter< + T, Char, typename std::enable_if::value>::type> { // Parses format specifiers stopping either at the end of the range or at the // terminating '}'. diff --git a/test/util-test.cc b/test/util-test.cc index 3adfe001..b63b9047 100644 --- a/test/util-test.cc +++ b/test/util-test.cc @@ -840,25 +840,6 @@ TEST(UtilTest, IsEnumConvertibleToInt) { } #endif -template -bool check_enable_if( - typename fmt::internal::enable_if::type *) { - return true; -} - -template -bool check_enable_if( - typename fmt::internal::enable_if::type *) { - return false; -} - -TEST(UtilTest, EnableIf) { - int i = 0; - EXPECT_TRUE(check_enable_if(&i)); - char c = 0; - EXPECT_FALSE(check_enable_if(&c)); -} - TEST(UtilTest, Conditional) { int i = 0; fmt::internal::conditional::type *pi = &i;