Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Fix reduce_by_key for non-default-initializable iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
gevtushenko committed Nov 14, 2022
1 parent 5e410e1 commit f77e2c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions thrust/system/cuda/detail/reduce_by_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -1079,12 +1079,13 @@ namespace __reduce_by_key {

size_type num_items = thrust::distance(keys_first, keys_last);

pair<KeysOutputIt, ValuesOutputIt> result = thrust::make_pair(keys_output, values_output);

if (num_items == 0)
{
return thrust::make_pair(keys_output, values_output);
return result;
}

pair<KeysOutputIt, ValuesOutputIt> result{};
THRUST_INDEX_TYPE_DISPATCH(result,
reduce_by_key_dispatch,
num_items,
Expand Down

0 comments on commit f77e2c6

Please sign in to comment.