NVIDIA / NVIDIA/cccl

[BUG] `std::string` + `thrust::tuple` on host fails to compile

Open
#728 3 comments 0 reactions 0 assignees View on GitHub
nvbug thrust
Dominant language
C++
Stars
2.5k
Forks
487
Avg merge
2d 7h
Merged PRs (30d)
296

Description

Although there is no support for `std::string` on device code, it should work on host code. However, when combined with `thrust::tuple` (in the example below using a `zip_iterator`) it fails to compile when it should compile successfully.
```cpp
int main(void) {
std::vector v = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
std::vector b = { 1, 0, 1, 1, 0, 0, 1, 1, 1};
std::vector output(v.size());

auto const first = thrust::make_zip_iterator(thrust::make_tuple(v.begin(), b.begin()));
auto const last = thrust::make_zip_iterator(thrust::make_tuple(v.end(), b.end()));

thrust::transform_inclusive_scan(
first,
last,
output.begin(),
[] (auto tuple) { return thrust::get<0>(tuple); },
thrust::maximum{});
}
```
Godbolt: https://godbolt.org/z/oRi8q5

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.