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

Various cleanups: Simplify product code #4121

Conversation

StephanTLavavej
Copy link
Member

  • <exception>: throw_with_nested() no longer needs _Glued to defend against the preprocessor.
  • Simplify: ios_base::_Iostate{} => ios_base::goodbit
    • It's just zero.
  • Simplify _Copy_unchecked()'s #ifdef __cpp_lib_concepts logic.
    • Here's a case where a negative test allows us to considerably simplify the code by avoiding the need for two #ifdef __cpp_lib_concepts regions (which was hard to follow). Now the code reads much more naturally - in concepts mode, we need to handle different iterator/sentinel types.
  • <random>: discard_block_engine can use its result_type typedef for min and max.
    • A constructor above is already using this typedef.
  • Style: Avoid using an assignment expression as an index in basic_string::_Eos().
    • We prefer to avoid expressions with lots of side effects, so we should update _Mysize before indexing. I'm using _New_size for the index since it's shorter.

…nd against the preprocessor.

After GH 3973, `_With_nested_v2<_Uty>` doesn't contain commas.
Here's a case where a negative test allows us to considerably simplify the code by avoiding the need for two `#ifdef __cpp_lib_concepts` regions (which was hard to follow).

Now the code reads much more naturally - in concepts mode, we need to handle different iterator/sentinel types.
…for `min` and `max`.

A constructor above is already using this typedef.
…ing::_Eos()`.

We prefer to avoid expressions with lots of side effects, so we should update `_Mysize` before indexing.

I'm using `_New_size` for the index since it's shorter.
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Oct 23, 2023
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner October 23, 2023 16:11
@StephanTLavavej StephanTLavavej self-assigned this Oct 24, 2023
@StephanTLavavej
Copy link
Member Author

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

@StephanTLavavej StephanTLavavej merged commit d15035d into microsoft:main Oct 25, 2023
37 checks passed
@StephanTLavavej StephanTLavavej deleted the dry-cleaning-5-simplify-product-code branch October 25, 2023 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants