mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-25 19:50:05 +00:00
Fix handling of unpacked args (#437)
This commit is contained in:
parent
1183621867
commit
f05888692c
@ -1538,7 +1538,7 @@ template <typename Context, typename ...Args>
|
||||
class format_arg_store {
|
||||
private:
|
||||
static const size_t NUM_ARGS = sizeof...(Args);
|
||||
static const bool IS_PACKED = NUM_ARGS <= internal::MAX_PACKED_ARGS;
|
||||
static const bool IS_PACKED = NUM_ARGS < internal::MAX_PACKED_ARGS;
|
||||
|
||||
typedef typename Context::char_type char_type;
|
||||
|
||||
@ -1552,7 +1552,7 @@ class format_arg_store {
|
||||
static const uint64_t TYPES = internal::make_type<Args..., void>();
|
||||
|
||||
format_arg_store(const Args &... args)
|
||||
: data_{{internal::MakeValue<Context>(args)...}} {}
|
||||
: data_{{internal::MakeArg<Context>(args)...}} {}
|
||||
|
||||
const value_type *data() const { return data_.data(); }
|
||||
};
|
||||
|
@ -1577,10 +1577,11 @@ void print_error(const char *file, int line, const char *format,
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(FormatTest, MaxArgs) {
|
||||
EXPECT_EQ("0123456789abcde",
|
||||
fmt::format("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e'));
|
||||
TEST(FormatTest, UnpackedArgs) {
|
||||
EXPECT_EQ("0123456789abcdefg",
|
||||
fmt::format("{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}",
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e',
|
||||
'f', 'g'));
|
||||
}
|
||||
|
||||
#if FMT_USE_USER_DEFINED_LITERALS
|
||||
|
Loading…
Reference in New Issue
Block a user