Ranges Library

Ranges Library#

2026-10-01

3 min read time

Applies to Linux and Windows

This page documents the ranges and iterator library headers available in libhipcxx, covering forward, bidirectional, random-access, and contiguous range concepts.

See the documentation of the standard headers <iterator> and <ranges>

Header

Content

Availability

<cuda/std/iterator>

Iterator related concepts and machinery such as cuda::std::forward_iterator

CCCL 2.3.0 / CUDA 12.4

<cuda/std/ranges>

Range related concepts and machinery such as cuda::std::ranges::forward_range and cuda::std::ranges::subrange

CCCL 2.4.0 / CUDA 12.5

Extensions#

All library features are available from C++17 onwards. The concepts can be used like type traits prior to C++20.

template<cuda::std::contiguos_range Range>
void do_something_with_ranges_in_cpp20(Range&& range) {...}

template<class Range, cuda::std::enable_if_t<cuda::std::contiguos_range<Range>, int> = 0>
void do_something_with_ranges_in_cpp17(Range&& range) {...}

Restrictions#

  • Subsumption does not work prior to C++20.

  • Subsumption is only partially implemented in the compiler until nvcc 12.4.

Omissions#

  • Range-based algorithms have not been implemented.

  • Views have not been implemented.