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

Commit db2ee03

Browse files
authored
Merge pull request #1827 from senior-zero/fix-main/github/reduce_by_key_zero_initializable
Fix reduce by key for non default initializable iterators
2 parents 5e410e1 + f77e2c6 commit db2ee03

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

thrust/system/cuda/detail/reduce_by_key.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,12 +1079,13 @@ namespace __reduce_by_key {
10791079

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

1082+
pair<KeysOutputIt, ValuesOutputIt> result = thrust::make_pair(keys_output, values_output);
1083+
10821084
if (num_items == 0)
10831085
{
1084-
return thrust::make_pair(keys_output, values_output);
1086+
return result;
10851087
}
10861088

1087-
pair<KeysOutputIt, ValuesOutputIt> result{};
10881089
THRUST_INDEX_TYPE_DISPATCH(result,
10891090
reduce_by_key_dispatch,
10901091
num_items,

0 commit comments

Comments
 (0)