Skip to content

Conversation

@StephanTLavavej
Copy link
Member

Works towards #602.

LWG-4067 "Inconsistency and potential infinity meta-recursion in std::chrono::zoned_time's constructors" is relevant, but it's P3 according to LWG so it probably won't be resolved any time soon. I believe that converting our constraints to concepts is an improvement, even if the Standard is kind of confused right now.

  • Move ref within type_identity_t for consistency.
  • zoned_time overhaul: Convert SFINAE to concepts.
    • I'm phrasing the constraints slightly differently from the Standard to perma-workaround EDG bugs, but I believe they're morally equivalent, and in practice everyone uses const time_zone* anyways.
  • zoned_time: Avoid delegating constructors.
    • In theory this repeats a bit of code, but IMO it clarifies what's happening (because zoned_time has so many constructors). This also avoids repeatedly evaluating constraints.

I'm phrasing the constraints slightly differently from the Standard
to perma-workaround EDG bugs, but I believe they're morally equivalent,
and in practice everyone uses `const time_zone*` anyways.
In theory this repeats a bit of code, but IMO it clarifies what's happening (because zoned_time has so many constructors).

This also avoids repeatedly evaluating constraints.
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Nov 24, 2025
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner November 24, 2025 16:36
@StephanTLavavej StephanTLavavej added the chrono C++20 chrono label Nov 24, 2025
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews Nov 24, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Final Review in STL Code Reviews Nov 24, 2025
Copy link
Member

@zacklj89 zacklj89 left a comment

Choose a reason for hiding this comment

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

Elegant 👍

@StephanTLavavej StephanTLavavej moved this from Final Review to Ready To Merge in STL Code Reviews Nov 25, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Nov 25, 2025
@StephanTLavavej
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chrono C++20 chrono enhancement Something can be improved

Projects

Status: Merging

Development

Successfully merging this pull request may close these issues.

2 participants