[DOC]: Improve clarity of Thrust iterator requirements
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 487
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 296
Description
### Is this a duplicate?
- [x] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cccl/issues) for this bug and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)
### Is this for new documentation, or an update to existing docs?
Update
### Describe the incorrect/future/missing documentation
For many algorithms Thrust documentation states that the iterators should model Forward Iterators with link to cppreference [`std::forward_iterator`](https://en.cppreference.com/w/cpp/iterator/forward_iterator.html). However, there is additional but not that clearly documented requirement, that the iterators should support incrementation by integers greater than 1. In terms of C++ standard technically this makes them random access iterators, e.g. [`thrust::swap_ranges`](https://nvidia.github.io/cccl/thrust/api/function_group__copying_1ga24337437822d9f7ca85f0c48b9248f6e.html).
This issue is about making this requirement more explicit.
Originally this was [reported to rocThrust repository](https://github.com/ROCm/rocm-libraries/issues/134), but they recommended to report it here.
Potentially relevant discussion about requiring random access iterators for C++ 26 ranges algorithms can be found in [C++ paper P3179 § 2.6](https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3179r7.html#random_access_requirement).
### If this is a correction, please provide a link to the incorrect documentation. If this is a new documentation request, please link to where you have looked.
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.