mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 02:29:08 +00:00
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 :
|
||||
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>
|
||||
void handle_dynamic_spec(
|
||||
Spec &value, arg_ref<typename Context::char_type> ref, Context &ctx) {
|
||||
@ -3259,16 +3255,6 @@ struct formatter<
|
||||
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.
|
||||
//
|
||||
// Usage:
|
||||
|
@ -106,11 +106,6 @@ void format_value(basic_buffer<Char> &buffer, const T &value) {
|
||||
output << value;
|
||||
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
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
||||
TEST(FormatTest, EnumFormatterUnambiguous) {
|
||||
fmt::formatter<TestEnum> f;
|
||||
}
|
||||
|
||||
#if FMT_HAS_FEATURE(cxx_strong_enums)
|
||||
enum TestFixedEnum : short { B };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user