Skip to content

Commit b8522b5

Browse files
author
Raghuveer Devulapalli
committed
Specify size key array at initialization
1 parent 32639b2 commit b8522b5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/x86simdsort.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ XSS_EXPORT_SYMBOL void object_qsort(T *arr, uint32_t arrsize, Func key_func)
4848
/* (1) Create a vector a keys */
4949
using return_type_of =
5050
typename decltype(std::function {key_func})::result_type;
51-
std::vector<return_type_of> keys;
52-
keys.reserve(arrsize);
51+
std::vector<return_type_of> keys(arrsize);
5352
for (size_t ii = 0; ii < arrsize; ++ii) {
5453
keys[ii] = key_func(arr[ii]);
5554
}

0 commit comments

Comments
 (0)