Increase the maximum number of formatting arguments on compilers without variadic templates to 15.
This commit is contained in:
parent
445663fade
commit
d59fbdcd4a
12
format.h
12
format.h
@ -1128,6 +1128,11 @@ inline StrFormatSpec<wchar_t> pad(
|
|||||||
# define FMT_GEN8(f) FMT_GEN7(f), f(7)
|
# define FMT_GEN8(f) FMT_GEN7(f), f(7)
|
||||||
# define FMT_GEN9(f) FMT_GEN8(f), f(8)
|
# define FMT_GEN9(f) FMT_GEN8(f), f(8)
|
||||||
# define FMT_GEN10(f) FMT_GEN9(f), f(9)
|
# define FMT_GEN10(f) FMT_GEN9(f), f(9)
|
||||||
|
# define FMT_GEN11(f) FMT_GEN10(f), f(10)
|
||||||
|
# define FMT_GEN12(f) FMT_GEN11(f), f(11)
|
||||||
|
# define FMT_GEN13(f) FMT_GEN12(f), f(12)
|
||||||
|
# define FMT_GEN14(f) FMT_GEN13(f), f(13)
|
||||||
|
# define FMT_GEN15(f) FMT_GEN14(f), f(14)
|
||||||
|
|
||||||
# define FMT_MAKE_TEMPLATE_ARG(n) typename T##n
|
# define FMT_MAKE_TEMPLATE_ARG(n) typename T##n
|
||||||
# define FMT_MAKE_ARG(n) const T##n &v##n
|
# define FMT_MAKE_ARG(n) const T##n &v##n
|
||||||
@ -1999,7 +2004,12 @@ inline void format_decimal(char *&buffer, T value) {
|
|||||||
FMT_WRAP(Char, ReturnType, func, call, 7, __VA_ARGS__) \
|
FMT_WRAP(Char, ReturnType, func, call, 7, __VA_ARGS__) \
|
||||||
FMT_WRAP(Char, ReturnType, func, call, 8, __VA_ARGS__) \
|
FMT_WRAP(Char, ReturnType, func, call, 8, __VA_ARGS__) \
|
||||||
FMT_WRAP(Char, ReturnType, func, call, 9, __VA_ARGS__) \
|
FMT_WRAP(Char, ReturnType, func, call, 9, __VA_ARGS__) \
|
||||||
FMT_WRAP(Char, ReturnType, func, call, 10, __VA_ARGS__)
|
FMT_WRAP(Char, ReturnType, func, call, 10, __VA_ARGS__) \
|
||||||
|
FMT_WRAP(Char, ReturnType, func, call, 11, __VA_ARGS__) \
|
||||||
|
FMT_WRAP(Char, ReturnType, func, call, 12, __VA_ARGS__) \
|
||||||
|
FMT_WRAP(Char, ReturnType, func, call, 13, __VA_ARGS__) \
|
||||||
|
FMT_WRAP(Char, ReturnType, func, call, 14, __VA_ARGS__) \
|
||||||
|
FMT_WRAP(Char, ReturnType, func, call, 15, __VA_ARGS__)
|
||||||
#endif // FMT_USE_VARIADIC_TEMPLATES
|
#endif // FMT_USE_VARIADIC_TEMPLATES
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1536,3 +1536,9 @@ void print_error(const char *file, int line, const char *format,
|
|||||||
fmt::print(format, args...);
|
fmt::print(format, args...);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
TEST(FormatTest, MaxArgs) {
|
||||||
|
EXPECT_EQ("0123456789abcde",
|
||||||
|
fmt::format("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e'));
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user