From 98ed65d7a8e2a5acce973a6c22f5fb62309c28b6 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Sun, 6 Dec 2015 18:30:02 +0100 Subject: [PATCH] Fix compilation in C++0x mode Alias templates may not be supported even if variadic templates are. --- format.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/format.h b/format.h index c8cf72ef..9e26d1bc 100644 --- a/format.h +++ b/format.h @@ -1902,11 +1902,13 @@ inline uint64_t make_type(const T &arg) { #if FMT_USE_VARIADIC_TEMPLATES template -using ArgArray = typename Conditional< - N < ArgList::MAX_PACKED_ARGS, - MakeValue[(N > 0) ? N : 1], - MakeArg[N + 1] ->::type; +struct ArgArray { + typedef typename Conditional< + N < ArgList::MAX_PACKED_ARGS, + MakeValue[(N > 0) ? N : 1], + MakeArg[N + 1] + >::type Type; +}; template inline uint64_t make_type(const Arg &first, const Args & ... tail) { @@ -1992,7 +1994,8 @@ class FormatBuf : public std::basic_streambuf { # define FMT_VARIADIC_VOID(func, arg_type) \ template \ void func(arg_type arg0, const Args & ... args) { \ - fmt::internal::ArgArray, sizeof...(Args)> array{args...}; \ + typename fmt::internal::ArgArray< \ + fmt::BasicFormatter, sizeof...(Args)>::Type array{args...}; \ func(arg0, fmt::ArgList(fmt::internal::make_type(args...), array)); \ } @@ -2000,7 +2003,8 @@ class FormatBuf : public std::basic_streambuf { # define FMT_VARIADIC_CTOR(ctor, func, arg0_type, arg1_type) \ template \ ctor(arg0_type arg0, arg1_type arg1, const Args & ... args) { \ - fmt::internal::ArgArray, sizeof...(Args)> array{args...}; \ + typename fmt::internal::ArgArray< \ + fmt::BasicFormatter, sizeof...(Args)>::Type array{args...}; \ func(arg0, arg1, fmt::ArgList(fmt::internal::make_type(args...), array)); \ } @@ -3218,7 +3222,8 @@ void arg(WStringRef, const internal::NamedArg&) FMT_DELETED_OR_UNDEFINED; template \ ReturnType func(FMT_FOR_EACH(FMT_ADD_ARG_NAME, __VA_ARGS__), \ const Args & ... args) { \ - fmt::internal::ArgArray, sizeof...(Args)> array{args...}; \ + typename fmt::internal::ArgArray< \ + fmt::BasicFormatter, sizeof...(Args)>::Type array{args...}; \ call(FMT_FOR_EACH(FMT_GET_ARG_NAME, __VA_ARGS__), \ fmt::ArgList(fmt::internal::make_type(args...), array)); \ }