#534·taskflow

taskflow find_if doesn't work with infinite ranges because std::distance is used

Author: bradphelanCreated Dec 1, 2023Updated Aug 6, 2025
Labelshelp wanted

In taskflow::find_if doesn't work with infinite ranges.

However an infinite range is a reasonable input to find_if. For example

std::ranges::iota(0)

produces an infinite range starting from 0.

However taskflow::find_if calls std::distance on the two iterators which cannot work if the second iterator is a sentinel std::unreachable_sentinel

In this case taskflow::find_if should find a sensible alternative to chunking. In our case we explicitly pass StaticPartitioner(1) so we don't require chunking.