Skip to content

Commit

Permalink
fold parameter pack
Browse files Browse the repository at this point in the history
  • Loading branch information
rwlee committed May 9, 2022
1 parent 2dd2045 commit 7ba960e
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions cpp/include/cudf/table/experimental/row_operators.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -277,16 +277,6 @@ class device_row_comparator {
std::optional<device_span<null_order const>> const _null_precedence;
}; // class device_row_comparator

template <typename... WeakOrderings>
__device__ bool any_equal(weak_ordering result, weak_ordering v, WeakOrderings... vs)
{
if constexpr (sizeof...(WeakOrderings) == 0) {
return result == v;
} else {
return result == v or any_equal(result, vs...);
}
}

/**
* @brief Wraps and interprets the result of templated Comparator that returns a weak_ordering.
* Returns true if the weak_ordering matches any of the templated values.
Expand All @@ -295,12 +285,12 @@ __device__ bool any_equal(weak_ordering result, weak_ordering v, WeakOrderings..
* @tparam values weak_ordering parameter pack of orderings to interpret as true
*/
template <typename Comparator, weak_ordering... values>
struct weak_ordering_comparator_impl {
__device__ bool operator()(size_type const& lhs, size_type const& rhs)
{
return any_equal(comparator(lhs, rhs), values...);
}
Comparator comparator;
struct weak_ordering_comparator_impl{
__device__ bool operator()(size_type const& lhs, size_type const& rhs){
weak_ordering const result = comparator(lhs, rhs);
return ( (result == values) || ...);
}
Comparator comparator;
};

/**
Expand Down

0 comments on commit 7ba960e

Please sign in to comment.