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

<chrono> formatting: weekday_last, month_weekday, month_weekday_last #1854

Merged
merged 2 commits into from
Apr 18, 2021

Conversation

StephanTLavavej
Copy link
Member

  • Add/test weekday_last, month_weekday, month_weekday_last.
    • In _Fill_tm():
      • weekday_indexed and weekday_last can share code.
      • month_weekday and month_weekday_last have different accessors.
      • Cleanup: Unify the code for year_month_weekday and year_month_weekday_last.
    • In _Is_valid_type():
      • weekday, weekday_indexed, and weekday_last all support the "weekday types".
      • month_weekday and month_weekday_last support "month types" and "weekday types". (As mentioned above, their accessors are actually weekday_indexed() and weekday_last(), but it seemed pointless to have separate cases to "recurse" into the weekday_indexed and weekday_last types, when the answer is always the same.)
      • Remove TRANSITION and change the final static_assert to "should be unreachable", which is the pattern that we use elsewhere.
    • Add the new formatters, all powered by _Fill_tm_formatter.
  • In P0355R7_calendars_and_time_zones_formatting/test.cpp:
    • Rename charT to CharT for consistency (this is needed by the STR macro, if it were ever used in these functions).
    • Add empty_braces_helper() to test both format("{}") and operator<<. This should supersede stream_helper() but I'm not making that change here.
    • Test the new types.
    • Implement tests for year_month_day_last, year_month_weekday, and year_month_weekday_last now that the necessary formatters are available.
    • Call the new test functions.
  • Update libcxx skips for C++20 features. (This extends slightly outside of chronat's focus, but given that we have to update the skips, it's nice to have no C++20 features listed as "missing" here.)

* In _Fill_tm():
  + weekday_indexed and weekday_last can share code.
  + month_weekday and month_weekday_last have different accessors.
  + Cleanup: Unify the code for year_month_weekday and year_month_weekday_last.
* In _Is_valid_type():
  + weekday, weekday_indexed, and weekday_last all support the "weekday types".
  + month_weekday and month_weekday_last support "month types" and "weekday types".
    (As mentioned above, their accessors are actually weekday_indexed() and
    weekday_last(), but it seemed pointless to have separate cases to "recurse"
    into the weekday_indexed and weekday_last types, when the answer is always
    the same.)
  + Remove TRANSITION and change the final static_assert to
    "should be unreachable", which is the pattern that we use elsewhere.
* Add the new formatters, all powered by _Fill_tm_formatter.

In P0355R7_calendars_and_time_zones_formatting/test.cpp:

* Rename charT to CharT for consistency (this is needed by the STR macro,
  if it were ever used in these functions).
* Add empty_braces_helper() to test both format("{}") and operator<<.
  This should supersede stream_helper() but I'm not making that change here.
* Test the new types.
* Implement tests for year_month_day_last, year_month_weekday, and
  year_month_weekday_last now that the necessary formatters are available.
* Call the new test functions.
@StephanTLavavej StephanTLavavej added cxx20 C++20 feature chrono C++20 chrono labels Apr 18, 2021
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner April 18, 2021 09:55
@StephanTLavavej StephanTLavavej merged commit d705b61 into microsoft:chronat2 Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chrono C++20 chrono cxx20 C++20 feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant