Skip to content

Fix find_if and find_if_not to support infinite ranges #715

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eckertliam
Copy link

The fix uses SFINAE to detect when E_t (end iterator type) differs from B_t (begin iterator type), indicating a sentinel-based range that cannot use std::distance.

- Add compile-time detection for sentinel-based ranges
- Fall back to sequential execution for infinite ranges
- Maintain parallel execution for finite ranges
- Fixes issue taskflow#534: taskflow::find_if doesn't work with infinite ranges

The fix uses SFINAE to detect when E_t (end iterator type) differs from B_t
(begin iterator type), indicating a sentinel-based range that cannot use std::distance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant