Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add args() accessor back to fmt::format_context #4310

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -2656,6 +2656,7 @@ class context {
FMT_CONSTEXPR auto arg_id(string_view name) const -> int {
return args_.get_id(name);
}
auto args() const -> const format_args& { return args_; }

// Returns an iterator to the beginning of the output range.
FMT_CONSTEXPR auto out() const -> iterator { return out_; }
Expand Down
9 changes: 9 additions & 0 deletions test/base-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -875,3 +875,12 @@ TEST(base_test, no_repeated_format_string_conversions) {
fmt::format_to(buf, nondeterministic_format_string());
#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