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>: Move the major part of visit_format_arg into a member function of basic_format_arg #3787

Merged

Conversation

frederick-vs-ja
Copy link
Contributor

Also fix a small bug on visiting 0. As the visitor always visits a cv-unqualified basic_format_arg lvalue, it's incorrect to use _STD forward<_Visitor>(_Vis)(0) which takes an int prvalue and can result in non-conforming ill-formedness.

IMO this PR will make it simpler to implement WG21-P2637R3. Unfortunately, we're perhaps unable to implement that paper at this moment.

of `basic_format_arg`

Also fix a small bug on an `int` rvalue.
@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner June 19, 2023 15:50
@StephanTLavavej StephanTLavavej added bug Something isn't working format C++20/23 format labels Jun 19, 2023
Copy link
Member

@barcharcraz barcharcraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good simplification, normally I wouldn't love factoring out _Visit like this given it's only used in one place, but given we're getting ride of the friend declaration here it doesn't seem like it's increasing the amount of indirection you need to follow to understand the code.

@StephanTLavavej StephanTLavavej self-assigned this Jun 20, 2023
@StephanTLavavej StephanTLavavej removed their assignment Jun 20, 2023
@StephanTLavavej StephanTLavavej self-assigned this Jun 22, 2023
@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 4768199 into microsoft:main Jun 22, 2023
@StephanTLavavej
Copy link
Member

Thanks for this refactoring and small bugfix! 🐞 🛠️ 🚀

@frederick-vs-ja frederick-vs-ja deleted the member-visit-prototype branch June 23, 2023 01:49
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
None yet
Development

Successfully merging this pull request may close these issues.

3 participants