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

<format>: Copy basic_format_args in tuple formatters when needed #4681

Merged

Conversation

frederick-vs-ja
Copy link
Contributor

Fixes #4651.

Also

  • avoids creating a temporary string when the minimum width is specified to 0 or not specified, completing the "Future work" in Measure display width in tuple formatter #4631;
  • reorganizes _Fmt_it, _Fmt_wit, format_context, and wformat_context with consistent alias templates; and
  • tests that functions taking non-constructible basic_format_context specializations can still be well-formed, despite that they can't be actually called.

Notes: LWG-4061 is now tentatively ready (although this PR doesn't speculatively implements it yet). Thus it should be now clear that basic_format_context objects can only be created by implementations, not user codes.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner May 21, 2024 16:20
@StephanTLavavej StephanTLavavej added bug Something isn't working format C++20/23 format labels May 22, 2024
@StephanTLavavej StephanTLavavej self-assigned this May 22, 2024
@cpplearner
Copy link
Contributor

This doesn't really copy the arguments, right? It copies basic_format_args, which holds a pointer to the array of format_arg objects.

@frederick-vs-ja frederick-vs-ja changed the title <format>: Copy format arguments in tuple formatters when needed <format>: Copy basic_format_args in tuple formatters when needed May 22, 2024
@StephanTLavavej
Copy link
Member

Thanks! I pushed a conflict-free merge with main and some minor nitpicks.

@StephanTLavavej StephanTLavavej removed their assignment May 29, 2024
This was referenced May 29, 2024
@StephanTLavavej StephanTLavavej self-assigned this May 29, 2024
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 7c25aef into microsoft:main May 30, 2024
39 checks passed
@StephanTLavavej
Copy link
Member

Thanks for fixing the runtime correctness of one of the most popular new features! 🪄 🐈 🐱

@frederick-vs-ja frederick-vs-ja deleted the formatter-tuple-copy-args branch May 30, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working format C++20/23 format
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

<format>: Underlying formatters of pair-or-tuple formatter cannot access format args
3 participants