Remove broken fmt::internal::format_enum (#818)
This commit is contained in:
parent
0c63d15ee9
commit
c68bab7014
@ -2322,10 +2322,6 @@ template <typename Context, typename T>
|
|||||||
struct format_type :
|
struct format_type :
|
||||||
std::integral_constant<bool, get_type<Context, T>::value != custom_type> {};
|
std::integral_constant<bool, get_type<Context, T>::value != custom_type> {};
|
||||||
|
|
||||||
// Specifies whether to format enums.
|
|
||||||
template <typename T, typename Enable = void>
|
|
||||||
struct format_enum : std::integral_constant<bool, std::is_enum<T>::value> {};
|
|
||||||
|
|
||||||
template <template <typename> class Handler, typename Spec, typename Context>
|
template <template <typename> class Handler, typename Spec, typename Context>
|
||||||
void handle_dynamic_spec(
|
void handle_dynamic_spec(
|
||||||
Spec &value, arg_ref<typename Context::char_type> ref, Context &ctx) {
|
Spec &value, arg_ref<typename Context::char_type> ref, Context &ctx) {
|
||||||
@ -3259,16 +3255,6 @@ struct formatter<
|
|||||||
internal::dynamic_format_specs<Char> specs_;
|
internal::dynamic_format_specs<Char> specs_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, typename Char>
|
|
||||||
struct formatter<T, Char,
|
|
||||||
typename std::enable_if<internal::format_enum<T>::value>::type>
|
|
||||||
: public formatter<int, Char> {
|
|
||||||
template <typename ParseContext>
|
|
||||||
auto parse(ParseContext &ctx) -> decltype(ctx.begin()) {
|
|
||||||
return ctx.begin();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// A formatter for types known only at run time such as variant alternatives.
|
// A formatter for types known only at run time such as variant alternatives.
|
||||||
//
|
//
|
||||||
// Usage:
|
// Usage:
|
||||||
|
@ -106,11 +106,6 @@ void format_value(basic_buffer<Char> &buffer, const T &value) {
|
|||||||
output << value;
|
output << value;
|
||||||
buffer.resize(buffer.size());
|
buffer.resize(buffer.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable builtin formatting of enums and use operator<< instead.
|
|
||||||
template <typename T>
|
|
||||||
struct format_enum<T,
|
|
||||||
typename std::enable_if<std::is_enum<T>::value>::type> : std::false_type {};
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
// Formats an object of type T that has an overloaded ostream operator<<.
|
// Formats an object of type T that has an overloaded ostream operator<<.
|
||||||
|
@ -1443,6 +1443,10 @@ TEST(FormatTest, Enum) {
|
|||||||
EXPECT_EQ("0", fmt::format("{}", A));
|
EXPECT_EQ("0", fmt::format("{}", A));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(FormatTest, EnumFormatterUnambiguous) {
|
||||||
|
fmt::formatter<TestEnum> f;
|
||||||
|
}
|
||||||
|
|
||||||
#if FMT_HAS_FEATURE(cxx_strong_enums)
|
#if FMT_HAS_FEATURE(cxx_strong_enums)
|
||||||
enum TestFixedEnum : short { B };
|
enum TestFixedEnum : short { B };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user