Unify common functors and optionally expose them
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 486
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 295
Description
We repeatedly define common functors all over CCCL, like `__return_constant` (at least 2 occurrences)., `equal_to_default_t` (4 occurrences), `always_true_predicate`, `equal_to_value`, `equal_to_t`, `always_false_t`, `always_true_t`, etc. Sometimes, the definitions are slightly different. We should pick a general enough version of those and put them somewhere central, like ``. They can remain internal, but we may also consider making them public.
The motivation is twofold: cleaner code, but also more opportunity for optmization. `cub::DeviceTransform` for example can optimize if the predicate is exactly `cub::detail::transform::always_true_predicate`. Any other predicate type (with the same definition) will not lead to an optimal code path.
Contributor guide
Assessment
This issue has not been assessed yet.