Skip to content

Commit

Permalink
Add strong index iterator docs. (NVIDIA#10888)
Browse files Browse the repository at this point in the history
This PR adds documentation for strongly-typed index iterators. Requested by @vyasr.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Mark Harris (https://github.com/harrism)

URL: rapidsai/cudf#10888
  • Loading branch information
bdice authored May 23, 2022
1 parent f10f380 commit d1a0191
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cpp/include/cudf/table/experimental/row_operators.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ namespace row {
enum class lhs_index_type : size_type {};
enum class rhs_index_type : size_type {};

/**
* @brief A counting iterator that uses strongly typed indices bound to tables.
*
* Performing lexicographic or equality comparisons between values in two
* tables requires the use of strongly typed indices. The strong index types
* `lhs_index_type` and `rhs_index_type` ensure that index values are bound to
* the correct table, regardless of the order in which these indices are
* provided to the call operator. This struct and its type aliases
* `lhs_iterator` and `rhs_iterator` provide an interface similar to a counting
* iterator, with strongly typed values to represent the table indices.
*
* @tparam Index The strong index type
*/
template <typename Index, typename Underlying = std::underlying_type_t<Index>>
struct strong_index_iterator : public thrust::iterator_facade<strong_index_iterator<Index>,
Index,
Expand Down Expand Up @@ -110,7 +123,14 @@ struct strong_index_iterator : public thrust::iterator_facade<strong_index_itera
Underlying begin{};
};

/**
* @brief Iterator representing indices into a left-side table.
*/
using lhs_iterator = strong_index_iterator<lhs_index_type>;

/**
* @brief Iterator representing indices into a right-side table.
*/
using rhs_iterator = strong_index_iterator<rhs_index_type>;

namespace lexicographic {
Expand Down

0 comments on commit d1a0191

Please sign in to comment.