@@ -215,10 +215,19 @@ class transform_iterator : public __transform_iterator_category_base<_Iter, _Fn>
215
215
}
216
216
217
217
// ! @brief Invokes the stored functor with the value pointed to by the stored iterator
218
+ _CCCL_TEMPLATE (class _Iter2 = _Iter)
219
+ _CCCL_REQUIRES (_CUDA_VSTD::regular_invocable<const _Fn&, _CUDA_VSTD::iter_reference_t <const _Iter2>>)
218
220
[[nodiscard]] _LIBCUDACXX_HIDE_FROM_ABI constexpr decltype (auto ) operator*() const
219
- noexcept (noexcept (_CUDA_VSTD::invoke(const_cast <_Fn&>( *__func_) , *__current_)))
221
+ noexcept (noexcept (_CUDA_VSTD::invoke(*__func_, *__current_)))
220
222
{
221
- return _CUDA_VSTD::invoke (const_cast <_Fn&>(*__func_), *__current_);
223
+ return _CUDA_VSTD::invoke (*__func_, *__current_);
224
+ }
225
+
226
+ // ! @brief Invokes the stored functor with the value pointed to by the stored iterator
227
+ [[nodiscard]] _LIBCUDACXX_HIDE_FROM_ABI constexpr decltype (auto )
228
+ operator*() noexcept (noexcept (_CUDA_VSTD::invoke(*__func_, *__current_)))
229
+ {
230
+ return _CUDA_VSTD::invoke (*__func_, *__current_);
222
231
}
223
232
224
233
// ! @brief Increments the stored iterator
@@ -289,11 +298,23 @@ class transform_iterator : public __transform_iterator_category_base<_Iter, _Fn>
289
298
// ! @param __n The additional offset
290
299
// ! @returns _CUDA_VSTD::invoke(__func_, __current_[__n])
291
300
_CCCL_TEMPLATE (class _Iter2 = _Iter)
292
- _CCCL_REQUIRES (_CUDA_VSTD::random_access_iterator<_Iter2>)
301
+ _CCCL_REQUIRES (_CUDA_VSTD::random_access_iterator<_Iter2> _CCCL_AND
302
+ _CUDA_VSTD::regular_invocable<const _Fn&, _CUDA_VSTD::iter_reference_t <const _Iter2>>)
293
303
[[nodiscard]] _LIBCUDACXX_HIDE_FROM_ABI constexpr decltype (auto ) operator[](difference_type __n) const
294
- noexcept (__transform_iterator_nothrow_subscript<_Fn, _Iter2>)
304
+ noexcept (__transform_iterator_nothrow_subscript<const _Fn, _Iter2>)
305
+ {
306
+ return _CUDA_VSTD::invoke (*__func_, __current_[__n]);
307
+ }
308
+
309
+ // ! @brief Subscripts the stored iterator by \p __n and applies the stored functor to the result
310
+ // ! @param __n The additional offset
311
+ // ! @returns _CUDA_VSTD::invoke(__func_, __current_[__n])
312
+ _CCCL_TEMPLATE (class _Iter2 = _Iter)
313
+ _CCCL_REQUIRES (_CUDA_VSTD::random_access_iterator<_Iter2>)
314
+ [[nodiscard]] _LIBCUDACXX_HIDE_FROM_ABI constexpr decltype (auto )
315
+ operator[](difference_type __n) noexcept (__transform_iterator_nothrow_subscript<_Fn, _Iter2>)
295
316
{
296
- return _CUDA_VSTD::invoke (const_cast <_Fn&>( *__func_) , __current_[__n]);
317
+ return _CUDA_VSTD::invoke (*__func_, __current_[__n]);
297
318
}
298
319
299
320
// ! @brief Compares two \c transform_iterator for equality, directly comparing the stored iterators
0 commit comments