Range and iterator tools, mostly backported from the standard library.
More...
|
| template<class R , class T = std::remove_reference_t<decltype(*std::begin(std::declval<R>()))>> |
| constexpr auto | binary_index (R &&r, const T &t) |
| | Find the index of a value in a sorted range.
|
| |
| template<class R , class A , class B > |
| bool | ckd_mul (R *result, A a, B b) |
| | A simple implementation of ckd_mul from C++26.
|
| |
| template<class R , class F > |
| constexpr auto | partition_point (R &&r, F &&f) |
| | A subset of std::ranges::partition_point from C++20.
|
| |
| template<class B , class R > |
| constexpr auto | permutation_view (B b, R r) |
| | A view of a (partial) permutation of a range.
|
| |
| template<class R > |
| constexpr auto | stride_view (R &&r, typename std::iterator_traits< decltype(std::begin(std::declval< R >()))>::difference_type n, decltype(n) o=0) |
| | A simple emulation of std::stride_view from C++23 for random-access underlying ranges.
|
| |
| template<class T > |
| auto | to_vector (span< T > s) |
| | Copy a span into a std::vector.
|
| |
| template<class S , class D , class F > |
| constexpr void | transform (S &&s, D d, F &&f) |
| | A simple subset of std::ranges::transform from C++20.
|
| |
Range and iterator tools, mostly backported from the standard library.
◆ to_vector()
template<class T >
| auto to_vector |
( |
span< T > | s | ) |
|
Copy a span into a std::vector.
◆ stride_view()
template<class R >
| auto stride_view |
( |
R && | r, |
|
|
typename std::iterator_traits< decltype(std::begin(std::declval< R >()))>::difference_type | n, |
|
|
decltype(n) | o = 0 ) |
|
constexpr |
A simple emulation of std::stride_view from C++23 for random-access underlying ranges.
- Parameters
-
| o | initial offset (not part of C++23) |
◆ transform()
template<class S , class D , class F >
| void transform |
( |
S && | s, |
|
|
D | d, |
|
|
F && | f ) |
|
constexpr |
A simple subset of std::ranges::transform from C++20.
This function supports GPU execution.
- Parameters
-
| s | source range |
| d | destination iterator |
◆ partition_point()
template<class R , class F >
| auto partition_point |
( |
R && | r, |
|
|
F && | f ) |
|
constexpr |
A subset of std::ranges::partition_point from C++20.
This function supports GPU execution.
- Parameters
-
- Returns
- an iterator to the first element for which f returns
false
◆ binary_index()
template<class R , class T = std::remove_reference_t<decltype(*std::begin(std::declval<R>()))>>
| auto binary_index |
( |
R && | r, |
|
|
const T & | t ) |
|
constexpr |
Find the index of a value in a sorted range.
This function supports GPU execution.
- Parameters
-
◆ permutation_view()
template<class B , class R >
| auto permutation_view |
( |
B | b, |
|
|
R | r ) |
|
constexpr |
A view of a (partial) permutation of a range.
Elements need not be sorted (though see also binary_index) and may be repeated (with caution for the resulting aliasing).
This function supports GPU execution.
- Parameters
-
| b | random-access starting iterator |
| r | range of offsets from b |
- Returns
- view of selected elements, random access iff
R is
◆ ckd_mul()
template<class R , class A , class B >
| bool ckd_mul |
( |
R * | result, |
|
|
A | a, |
|
|
B | b ) |
A simple implementation of ckd_mul from C++26.
- Parameters
-
| result | address to store the multiplication result |
| a | unsigned integer value |
| b | unsigned integer value |
- Returns
- false if *result was assigned a valid multiplication result, true otherwise.