From 983b883380747ad46246b8a57b4df6a751655f77 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Sun, 6 Dec 2015 14:00:37 +0100 Subject: [PATCH] Use MakeArg constructor instead of manually constructing Arg --- format.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/format.h b/format.h index 91b5ec6ad0ce..c8cf72efda59 100644 --- a/format.h +++ b/format.h @@ -1218,14 +1218,9 @@ template struct NamedArg : Arg { BasicStringRef name; - typedef internal::MakeValue< BasicFormatter > MakeValue; - template NamedArg(BasicStringRef argname, const T &x) - : name(argname) { - value = MakeValue(x); - type = static_cast(MakeValue::type(x)); - } + : Arg(internal::MakeArg< BasicFormatter >(x)), name(argname) {} }; #define FMT_DISPATCH(call) static_cast(this)->call @@ -2900,11 +2895,8 @@ void format(BasicFormatter &f, const Char *&format_str, const T &value) { output << value; BasicStringRef str(&buffer[0], format_buf.size()); - typedef internal::MakeValue< BasicFormatter > MakeValue; - internal::Arg arg; - arg.value = MakeValue(str); - arg.type = static_cast(MakeValue::type(str)); - format_str = f.format(format_str, arg); + typedef internal::MakeArg< BasicFormatter > MakeArg; + format_str = f.format(format_str, MakeArg(str)); } // Reports a system error without throwing an exception.