From 74fc821cd6d6c76d0c0dde76ec1ab6873654b7c5 Mon Sep 17 00:00:00 2001 From: Arthur Danskin Date: Thu, 6 Apr 2017 16:31:33 -0400 Subject: [PATCH] fix for xcode build --- fmt/format.h | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index 514c7dba..82912ead 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -1283,6 +1283,30 @@ void format_arg(Formatter &, const Char *, const T &) { "an overload of format_arg."); } +template +class MakeArg; + +// first argument to format_arg for custom formatters +template +class UserFormatter { + AF &af_; +public: + typedef AF ArgFormatter; + typedef typename AF::Char Char; + typedef MakeArg< UserFormatter > MakeArg; + + UserFormatter(AF &af) : af_(af) {} + + BasicWriter &writer() { return af_.writer(); } + + void visit(const Arg &arg) { af_.visit(arg); } + + const Char *format(const Char *&format_str, const internal::Arg &arg) + { + af_.visit(format_str, arg); + } +}; + // Makes an Arg object from any type. template @@ -1485,28 +1509,6 @@ class RuntimeError : public std::runtime_error { template class ArgMap; - - -// first argument to format_arg for custom formatters -template -class UserFormatter { - AF &af_; -public: - typedef AF ArgFormatter; - typedef typename AF::Char Char; - typedef MakeArg< UserFormatter > MakeArg; - - UserFormatter(AF &af) : af_(af) {} - - BasicWriter &writer() { return af_.writer(); } - - void visit(const Arg &arg) { af_.visit(arg); } - - const Char *format(const Char *&format_str, const internal::Arg &arg) - { - af_.visit(format_str, arg); - } -}; } // namespace internal @@ -2183,7 +2185,7 @@ class BasicArgFormatter : public internal::ArgFormatterBase { /** Formats an argument of a custom (user-defined) type. */ void visit_custom(internal::Arg::CustomValue c) { - UserFormatter uf(*this); + internal::UserFormatter uf(*this); c.format(&uf, c.value, &format_); } }; @@ -3744,7 +3746,7 @@ const Char *BasicFormatter::format( typename ArgFormatter::SpecType spec; if (*s == ':') { if (arg.type == Arg::CUSTOM) { - UserFormatter > uf(*this); + internal::UserFormatter > uf(*this); arg.custom.format(&uf, arg.custom.value, &s); return s; }