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

when_all: add Sentinel support to when_all_succeed() #2565

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

tchaikov
Copy link
Contributor

@tchaikov tchaikov commented Dec 5, 2024

Extend when_all_succeed() and iterator_range_estimate_vector_capacity() to accept ranges with heterogeneous iterator
and sentinel types by adding a separate template parameter for the sentinel.

This change enhances the `iterator_range_estimate_vector_capacity()`
helper function to support ranges with potentially different iterator
and sentinel types. Key improvements include:

- Replace iterator category parameter with C++20 iterator concepts
- Use `std::ranges::distance()` for robust distance calculation
- Prepare groundwork for range support in `when_all_succeed()`
- Remove outdated comment about O(n) performance for random access iterators

The modification allows the function to work with a broader range of
iterator types, including those from standard library ranges with
heterogeneous iterator and sentinel types.

Signed-off-by: Kefu Chai <[email protected]>
Extend `when_all_succeed()` to accept ranges with heterogeneous iterator
and sentinel types by adding a separate template parameter for the sentinel.

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov tchaikov force-pushed the when-all-with-ranges branch from 5c7dd23 to 156f5e5 Compare December 5, 2024 02:56
@xemul xemul closed this in f840b86 Dec 6, 2024
@xemul xemul merged commit f840b86 into scylladb:master Dec 6, 2024
15 checks passed
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.

2 participants