NVIDIA / NVIDIA/cccl

Disallow operators that accept lvalue references where mutation is prohibited

Open
#829 0 comments 0 reactions 0 assignees View on GitHub
thrust
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

We are [going to](https://github.com/NVIDIA/cccl/issues/908) make operators accepting lvalue references a compilation error in CUB. This change will propagate to Thrust for algorithms like `thrust::transform_reduce`. Other algorithms, however, wrap user operators into thrust ones that actually accept lvalue references to constant values:

```cpp
bool all_of(InputIterator first, InputIterator last, Predicate pred)
{
return thrust::find_if(exec, first, last, thrust::detail::not1(pred)) == last;
}
```

This makes the issue not detectable by CUB. We have to find such thrust wrappers and add according static asserts in them.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.