mirror of
https://github.com/fmtlib/fmt.git
synced 2025-04-16 14:42:25 +00:00
Add args() accessor back to fmt::format_context (#4310)
Add args() accessor back to fmt::format_context Add test that would fail to compile if you can't create a fmt::format_context from another fmt::format_context
This commit is contained in:
parent
01914f0389
commit
937b7c5c10
@ -2656,6 +2656,7 @@ class context {
|
|||||||
FMT_CONSTEXPR auto arg_id(string_view name) const -> int {
|
FMT_CONSTEXPR auto arg_id(string_view name) const -> int {
|
||||||
return args_.get_id(name);
|
return args_.get_id(name);
|
||||||
}
|
}
|
||||||
|
auto args() const -> const format_args& { return args_; }
|
||||||
|
|
||||||
// Returns an iterator to the beginning of the output range.
|
// Returns an iterator to the beginning of the output range.
|
||||||
FMT_CONSTEXPR auto out() const -> iterator { return out_; }
|
FMT_CONSTEXPR auto out() const -> iterator { return out_; }
|
||||||
|
@ -875,3 +875,12 @@ TEST(base_test, no_repeated_format_string_conversions) {
|
|||||||
fmt::format_to(buf, nondeterministic_format_string());
|
fmt::format_to(buf, nondeterministic_format_string());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(base_test, format_context_accessors) {
|
||||||
|
class copier {
|
||||||
|
static fmt::format_context copy(fmt::appender app,
|
||||||
|
const fmt::format_context& ctx) {
|
||||||
|
return fmt::format_context(std::move(app), ctx.args(), ctx.locale());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user