Fmt: Dynamic construction of *named* argument lists?

Created on 30 Apr 2020  Â·  7Comments  Â·  Source: fmtlib/fmt

Hey, I noticed in the latest release that there is now a dynamic_format_arg_store, but it doesn't support named arguments. Is there a plan to add such capability? I'm thinking of something along the lines of:

fmt::dynamic_format_named_argument_store<fmt::format_context> store;
store.emplace_back("name", 123);
store.emplace_back("another_name", 456);
fmt::vprint("{name} + {another_name}", store);

Would this be hard to implement? I can take a crack at it given some starting guidance.

Most helpful comment

I was going to add support for named arguments during May holidays in
Russia.

чт, 30 апр. 2020 г., 09:33 Michael Suo notifications@github.com:

From #1584 https://github.com/fmtlib/fmt/pull/1584, it looks like
@vsolontsov-ll https://github.com/vsolontsov-ll already had some ideas
for how to support named arguments. Any update there?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/fmtlib/fmt/issues/1655#issuecomment-621641209, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/ANMY27HIJZMTK6J53MRMXVDRPELUVANCNFSM4MVG6VKA
.

All 7 comments

From https://github.com/fmtlib/fmt/pull/1584, it looks like @vsolontsov-ll already had some ideas for how to support named arguments. Any update there?

I was going to add support for named arguments during May holidays in
Russia.

чт, 30 апр. 2020 г., 09:33 Michael Suo notifications@github.com:

From #1584 https://github.com/fmtlib/fmt/pull/1584, it looks like
@vsolontsov-ll https://github.com/vsolontsov-ll already had some ideas
for how to support named arguments. Any update there?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/fmtlib/fmt/issues/1655#issuecomment-621641209, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/ANMY27HIJZMTK6J53MRMXVDRPELUVANCNFSM4MVG6VKA
.

Amazing :) Thank you for your effort!

Thanks, @vsolontsov-ll, for looking into it.

And BTW thanks, @suo, for adding {fmt} to pytorch!

Reopening since this still needs to be documented.

Was this page helpful?
0 / 5 - 0 ratings