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

<xutility>: Fix inaccurate constraint of _Equal_rev_pred #4149

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

hewillk
Copy link
Contributor

@hewillk hewillk commented Nov 6, 2023

When no match is found, we return {false, _It1 {}}; which implies that _It1 must be a forward_iterator that can be default-constructed.

@hewillk hewillk requested a review from a team as a code owner November 6, 2023 08:37
@frederick-vs-ja
Copy link
Contributor

_Equal_rev_pred is only used twice in MSVC STL:

  • In _Search_fn, the iterators are required to be forward_iterator:

    auto [_Match, _Mid1] = _RANGES _Equal_rev_pred(_First1, _First2, _Last2, _Pred, _Proj1, _Proj2);

  • In _Find_end_fn, only random_access_iterators are used with _Equal_rev_pred:

    _RANGES _Equal_rev_pred(_Candidate, _First2, _First2 + _Count2, _Pred, _Proj1, _Proj2);

Although the change is not strictly needed, it would be a sanity improvement to me.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Nov 6, 2023
@StephanTLavavej StephanTLavavej self-assigned this Nov 6, 2023
@StephanTLavavej StephanTLavavej removed their assignment Nov 7, 2023
@StephanTLavavej StephanTLavavej self-assigned this Nov 9, 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 e8390ef into microsoft:main Nov 10, 2023
37 checks passed
@StephanTLavavej
Copy link
Member

Thanks for cleaning up this constraint so it makes more sense! 🧹 ✨ 😺

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.

5 participants