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

Consistent iterator type checking for parallel algorithms #3899

Merged

Conversation

frederick-vs-ja
Copy link
Contributor

Fixes #2985.

Notes:

  • This PR is introducing _REQUIRE_CPP17_MUTABLE_BIDIRECTIONAL_ITERATOR and _REQUIRE_CPP17_MUTABLE_RANDOM_ACCESS_ITERATOR, which require mutable iterators to be Cpp17BidirectionalIterator and Cpp17RandomAccessIterator respectively.
  • If a parallel algorithm calls another parallel overload, then the checking is only made in the other overload.
  • reverse_copy is specially handled, since it requires the source iterators to be bidirectional.

It seems that the checking also make sense for non-parallel (non-ranges) algorithms, but we can do this in another PR.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner July 22, 2023 06:13
@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label Jul 22, 2023
stl/inc/algorithm Outdated Show resolved Hide resolved
stl/inc/xutility Outdated Show resolved Hide resolved
@StephanTLavavej

This comment was marked as resolved.

stl/inc/algorithm Outdated Show resolved Hide resolved
@CaseyCarter
Copy link
Member

I've pushed a commit to define _REQUIRE_BIDIRECTIONAL_ITERATOR (Note: no CPP17) and use it in the parallel reverse_copy instead of directly static_asserting to be consistent with the other requirement macros.

@StephanTLavavej StephanTLavavej self-assigned this Jul 31, 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 e2b6a81 into microsoft:main Aug 1, 2023
35 checks passed
@StephanTLavavej
Copy link
Member

✅ ✔️ ☑️

@frederick-vs-ja frederick-vs-ja deleted the par-algo-type-checking branch August 1, 2023 23:18
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.

<algorithm>, <execution>, <xutility>: Parallel algorithms inconsistently _REQUIRE_MEOW
3 participants