From 3c6053c535912b285d9fc39288fb7c3f9d5e8fce Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 17 May 2023 07:57:53 -0700 Subject: [PATCH] Cleanup basic_printf_context --- include/fmt/core.h | 2 +- include/fmt/format.h | 3 +-- include/fmt/printf.h | 9 +++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 8848939f..38abb71b 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1698,7 +1698,7 @@ template class basic_format_context { public: using iterator = OutputIt; - using format_arg = basic_format_arg; + using format_arg = basic_format_arg; // DEPRECATED! using format_args = basic_format_args; using parse_context_type = basic_format_parse_context; template using formatter_type = formatter; diff --git a/include/fmt/format.h b/include/fmt/format.h index a6265b79..c78364a0 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -4082,8 +4082,7 @@ FMT_CONSTEXPR auto get_dynamic_spec(FormatArg arg, ErrorHandler eh) -> int { } template -FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> - typename Context::format_arg { +FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> decltype(ctx.arg(id)) { auto arg = ctx.arg(id); if (!arg) ctx.on_error("argument not found"); return arg; diff --git a/include/fmt/printf.h b/include/fmt/printf.h index fddcab06..5f4bdaa7 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -25,7 +25,6 @@ template class basic_printf_context { public: using char_type = Char; - using format_arg = basic_format_arg; using parse_context_type = basic_format_parse_context; template using formatter_type = printf_formatter; @@ -39,12 +38,14 @@ template class basic_printf_context { basic_format_args args) : out_(out), args_(args) {} - OutputIt out() { return out_; } + auto out() -> OutputIt { return out_; } 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 { + return args_.get(id); + } FMT_CONSTEXPR void on_error(const char* message) { detail::error_handler().on_error(message);