Moved make_arg_formatter to printf.h

Per PR suggestion.
This commit is contained in:
Kenneth Weiss 2023-01-12 19:11:30 -08:00
parent 4097a242a9
commit ad7f0c2286
2 changed files with 9 additions and 6 deletions

View File

@ -3592,11 +3592,6 @@ template <typename Char> struct arg_formatter {
// to the parse context. // to the parse context.
return out; 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 { template <typename Char> struct custom_formatter {

View File

@ -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. // The ``printf`` argument formatter.
template <typename OutputIt, typename Char> template <typename OutputIt, typename Char>
class printf_arg_formatter : public arg_formatter<Char> { class printf_arg_formatter : public arg_formatter<Char> {
@ -235,7 +243,7 @@ class printf_arg_formatter : public arg_formatter<Char> {
public: public:
printf_arg_formatter(OutputIt iter, format_specs<Char>& s, context_type& ctx) 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); } OutputIt operator()(monostate value) { return base::operator()(value); }