Skip to content

Commit

Permalink
allowing stable sort by key to use radix sort
Browse files Browse the repository at this point in the history
  • Loading branch information
danhoeflinger committed May 30, 2024
1 parent bd2253d commit 318a956
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions clang/runtime/dpct-rt/include/dpct/dpl_extras/algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,9 @@ void stable_sort(Policy &&policy, Iter1 keys_first, Iter1 keys_last,
std::is_same<typename std::iterator_traits<Iter2>::iterator_category,
std::random_access_iterator_tag>::value,
"Iterators passed to algorithms must be random-access iterators.");
std::stable_sort(
std::forward<Policy>(policy),
oneapi::dpl::make_zip_iterator(keys_first, values_first),
oneapi::dpl::make_zip_iterator(
keys_last, values_first + std::distance(keys_first, keys_last)),
internal::compare_key_fun<Comp>(comp));
//oneDPL::sort_by_key is explicitly stable
oneapi::dpl::sort_by_key(std::forward<Policy>(policy), keys_first, keys_last,
values_first, comp);
}

template <class Policy, class Iter1, class Iter2>
Expand Down

0 comments on commit 318a956

Please sign in to comment.