Remove detail::error_handler
This commit is contained in:
parent
c142385033
commit
0b39d67103
@ -646,15 +646,6 @@ enum {
|
||||
|
||||
// DEPRECATED!
|
||||
FMT_NORETURN FMT_API void throw_format_error(const char* message);
|
||||
|
||||
struct error_handler {
|
||||
constexpr error_handler() = default;
|
||||
|
||||
// This function is intentionally not constexpr to give a compile-time error.
|
||||
FMT_NORETURN void on_error(const char* message) {
|
||||
throw_format_error(message);
|
||||
}
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
/** Throws ``format_error`` with a given message. */
|
||||
@ -1772,9 +1763,8 @@ template <typename OutputIt, typename Char> class basic_format_context {
|
||||
}
|
||||
auto args() const -> const format_args& { return args_; }
|
||||
|
||||
// DEPRECATED!
|
||||
FMT_CONSTEXPR auto error_handler() -> detail::error_handler { return {}; }
|
||||
void on_error(const char* message) { error_handler().on_error(message); }
|
||||
// This function is intentionally not constexpr to give a compile-time error.
|
||||
void on_error(const char* message) { throw_format_error(message); }
|
||||
|
||||
// Returns an iterator to the beginning of the output range.
|
||||
FMT_CONSTEXPR auto out() -> iterator { return out_; }
|
||||
|
@ -4360,7 +4360,7 @@ void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
|
||||
return;
|
||||
}
|
||||
|
||||
struct format_handler : error_handler {
|
||||
struct format_handler {
|
||||
basic_format_parse_context<Char> parse_context;
|
||||
buffer_context<Char> context;
|
||||
|
||||
@ -4412,6 +4412,8 @@ void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
|
||||
context.advance_to(visit_format_arg(f, arg));
|
||||
return begin;
|
||||
}
|
||||
|
||||
void on_error(const char* message) { throw_format_error(message); }
|
||||
};
|
||||
detail::parse_format_string<false>(fmt, format_handler(out, fmt, args, loc));
|
||||
}
|
||||
|
@ -53,9 +53,7 @@ template <typename Char> class basic_printf_context {
|
||||
return args_.get(id);
|
||||
}
|
||||
|
||||
FMT_CONSTEXPR void on_error(const char* message) {
|
||||
detail::error_handler().on_error(message);
|
||||
}
|
||||
void on_error(const char* message) { throw_format_error(message); }
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
@ -573,7 +573,7 @@ struct arg_scanner {
|
||||
}
|
||||
};
|
||||
|
||||
struct scan_handler : error_handler {
|
||||
struct scan_handler {
|
||||
private:
|
||||
scan_parse_context parse_ctx_;
|
||||
scan_context scan_ctx_;
|
||||
@ -626,7 +626,7 @@ struct scan_handler : error_handler {
|
||||
return begin;
|
||||
}
|
||||
|
||||
void on_error(const char* message) { error_handler::on_error(message); }
|
||||
void on_error(const char* message) { throw_format_error(message); }
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user