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>: Make non-Standard constructors of basic_format_arg::handle and basic_format_context private #4489

Merged

Conversation

frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Mar 18, 2024

Notes:

  • handle's constructor is exposition only and private in the standard wording ([format.arg]/10), so at least the constructor shouldn't be callable from user code. Removing static_assert messages due to this.
  • The standard wording seemingly leaves special member functions of basic_format_context implicitly declared ([format.context]), which means that its default constructor should be declared and defaulted.
  • Internal non-Standard constructors of basic_format_context are changed to take references to avoid double copy/move.
  • Now constructions of basic_format_arg, handle, and basic_format_context are consistently performed by _Make_from static member functions, and _Make_from functions are consistently marked _NODISCARD.

`basic_format_arg::handle` and `basic_format_context`
@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner March 18, 2024 17:21
@StephanTLavavej StephanTLavavej self-assigned this Mar 18, 2024
@StephanTLavavej StephanTLavavej added enhancement Something can be improved format C++20/23 format labels Mar 18, 2024
stl/inc/format Outdated Show resolved Hide resolved
stl/inc/format Outdated Show resolved Hide resolved
@StephanTLavavej
Copy link
Member

/azp run STL-CI

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@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 243cffc into microsoft:main Mar 19, 2024
35 checks passed
@StephanTLavavej
Copy link
Member

Thanks for improving <format>'s strictness! 🔒 📈 😻

@frederick-vs-ja frederick-vs-ja deleted the format-non-standard-ctor branch March 19, 2024 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved format C++20/23 format
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants