Skip to content

Commit

Permalink
Moved make_arg_formatter to printf.h
Browse files Browse the repository at this point in the history
Per PR suggestion.
  • Loading branch information
kennyweiss committed Jan 13, 2023
1 parent 4097a24 commit ad7f0c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 0 additions & 5 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -3592,11 +3592,6 @@ template <typename Char> struct arg_formatter {
// to the parse context.
return out;
}

static auto make_arg_formatter(iterator iter, format_specs<Char>& s)
-> arg_formatter {
return {iter, s, locale_ref()};
}
};

template <typename Char> struct custom_formatter {
Expand Down
10 changes: 9 additions & 1 deletion include/fmt/printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ template <typename Char> class printf_width_handler {
}
};

// Workaround for a bug with the XL compiler when initializing
// printf_arg_formatter's base class.
template <typename Char>
auto make_arg_formatter(buffer_appender<Char> iter, format_specs<Char>& s)
-> arg_formatter<Char> {
return {iter, s, locale_ref()};
}

// The ``printf`` argument formatter.
template <typename OutputIt, typename Char>
class printf_arg_formatter : public arg_formatter<Char> {
Expand All @@ -235,7 +243,7 @@ class printf_arg_formatter : public arg_formatter<Char> {

public:
printf_arg_formatter(OutputIt iter, format_specs<Char>& s, context_type& ctx)
: base(base::make_arg_formatter(iter, s)), context_(ctx) {}
: base(make_arg_formatter(iter, s)), context_(ctx) {}

OutputIt operator()(monostate value) { return base::operator()(value); }

Expand Down

0 comments on commit ad7f0c2

Please sign in to comment.