NVIDIA / NVIDIA/cccl

[DOC] Clarify zip_function docs.

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

Description

This sentence in the docs for zip_function is very confusing. I think it's because it has an "if" with no "then".

https://github.com/NVIDIA/thrust/blob/d461afaefdb0b22d830f8d5e9a7b42aebff7004f/thrust/zip_function.h#L79-L82

I also think this is an example of a specific use of zip_function, rather than general documentation.

Suggested improvement (based on suggestion from @jrhemstad ):

```
/*! \p zip_function adapts a callable that takes N arguments and enables invoking it with
* a tuple-like object of at least N elements.
*
* `zip_function` is useful in combination with `zip_iterator`, which adapts `N` iterators into
* a `thrust::tuple` of `N` elements. Using a `zip_iterator` normally requires writing a callable
* that operates on a `tuple` directly. This can be inconvenient. `zip_function` enables using
* a `zip_iterator` without having to handle the `tuples` directly. Similar to C++ "Structured Bindings",
* it does this by destructuring the tuple of N elements into N independent arguments.
* ```

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.