Cleanup basic_printf_context

This commit is contained in:
Victor Zverovich 2023-05-17 07:57:53 -07:00
parent 4a392adaa7
commit 3c6053c535
3 changed files with 7 additions and 7 deletions

View File

@ -1698,7 +1698,7 @@ template <typename OutputIt, typename Char> class basic_format_context {
public: public:
using iterator = OutputIt; using iterator = OutputIt;
using format_arg = basic_format_arg<basic_format_context>; using format_arg = basic_format_arg<basic_format_context>; // DEPRECATED!
using format_args = basic_format_args<basic_format_context>; using format_args = basic_format_args<basic_format_context>;
using parse_context_type = basic_format_parse_context<Char>; using parse_context_type = basic_format_parse_context<Char>;
template <typename T> using formatter_type = formatter<T, Char>; template <typename T> using formatter_type = formatter<T, Char>;

View File

@ -4082,8 +4082,7 @@ FMT_CONSTEXPR auto get_dynamic_spec(FormatArg arg, ErrorHandler eh) -> int {
} }
template <typename Context, typename ID> template <typename Context, typename ID>
FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> decltype(ctx.arg(id)) {
typename Context::format_arg {
auto arg = ctx.arg(id); auto arg = ctx.arg(id);
if (!arg) ctx.on_error("argument not found"); if (!arg) ctx.on_error("argument not found");
return arg; return arg;

View File

@ -25,7 +25,6 @@ template <typename OutputIt, typename Char> class basic_printf_context {
public: public:
using char_type = Char; using char_type = Char;
using format_arg = basic_format_arg<basic_printf_context>;
using parse_context_type = basic_format_parse_context<Char>; using parse_context_type = basic_format_parse_context<Char>;
template <typename T> using formatter_type = printf_formatter<T>; template <typename T> using formatter_type = printf_formatter<T>;
@ -39,12 +38,14 @@ template <typename OutputIt, typename Char> class basic_printf_context {
basic_format_args<basic_printf_context> args) basic_format_args<basic_printf_context> args)
: out_(out), args_(args) {} : out_(out), args_(args) {}
OutputIt out() { return out_; } auto out() -> OutputIt { return out_; }
void advance_to(OutputIt it) { out_ = it; } void advance_to(OutputIt it) { out_ = it; }
detail::locale_ref locale() { return {}; } auto locale() -> detail::locale_ref { return {}; }
format_arg arg(int id) const { return args_.get(id); } auto arg(int id) const -> basic_format_arg<basic_printf_context> {
return args_.get(id);
}
FMT_CONSTEXPR void on_error(const char* message) { FMT_CONSTEXPR void on_error(const char* message) {
detail::error_handler().on_error(message); detail::error_handler().on_error(message);