mirror of
https://github.com/shadps4-emu/ext-fmt.git
synced 2025-03-03 15:48:47 +00:00
Add copy constructor for dynamic_format_arg_store, and test
This commit is contained in:
parent
561834650a
commit
63fe2d5bd2
@ -143,6 +143,18 @@ class dynamic_format_arg_store
|
||||
}
|
||||
|
||||
public:
|
||||
constexpr dynamic_format_arg_store() = default;
|
||||
|
||||
constexpr dynamic_format_arg_store(
|
||||
const dynamic_format_arg_store<Context>& store)
|
||||
:
|
||||
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
|
||||
basic_format_args<Context>(),
|
||||
#endif
|
||||
data_(store.data_),
|
||||
named_info_(store.named_info_) {
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Adds an argument into the dynamic store for later passing to a formatting
|
||||
|
@ -171,3 +171,16 @@ TEST(args_test, throw_on_copy) {
|
||||
}
|
||||
EXPECT_EQ(fmt::vformat("{}", store), "foo");
|
||||
}
|
||||
|
||||
TEST(args_test, copy_constructor) {
|
||||
auto store = fmt::dynamic_format_arg_store<fmt::format_context>();
|
||||
store.push_back(fmt::arg("test1", "value1"));
|
||||
store.push_back(fmt::arg("test2", "value2"));
|
||||
store.push_back(fmt::arg("test3", "value3"));
|
||||
|
||||
auto store2 = store;
|
||||
store2.push_back(fmt::arg("test4", "value4"));
|
||||
|
||||
auto result = fmt::vformat("{test1} {test2} {test3} {test4}", store2);
|
||||
EXPECT_EQ(result, "value1 value2 value3 value4");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user