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

Dynamic construction of *named* argument lists? #1655

Closed
suo opened this issue Apr 30, 2020 · 7 comments · Fixed by #1663
Closed

Dynamic construction of *named* argument lists? #1655

suo opened this issue Apr 30, 2020 · 7 comments · Fixed by #1663

Comments

@suo
Copy link

suo commented Apr 30, 2020

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.

@suo
Copy link
Author

suo commented Apr 30, 2020

From #1584, it looks like @vsolontsov-ll already had some ideas for how to support named arguments. Any update there?

@vsolontsov-ll
Copy link
Contributor

vsolontsov-ll commented Apr 30, 2020 via email

@suo
Copy link
Author

suo commented Apr 30, 2020

Amazing :) Thank you for your effort!

@vitaut
Copy link
Contributor

vitaut commented May 1, 2020

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

@vitaut
Copy link
Contributor

vitaut commented May 1, 2020

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

vsolontsov-ll added a commit to vsolontsov-ll/fmt that referenced this issue May 3, 2020
vitaut pushed a commit that referenced this issue May 9, 2020
Dynamic arguments storage. Implementation of enhancement from issue
#1170.
@vitaut vitaut reopened this May 9, 2020
@vitaut
Copy link
Contributor

vitaut commented May 9, 2020

Reopening since this still needs to be documented.

@vitaut
Copy link
Contributor

vitaut commented May 15, 2020

@vitaut vitaut closed this as completed May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants