-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
I am having trouble to compile the following piece of code:
Lines 124 to 131 in 16cf563
| ourType orderedArr[elements]; | |
| for (int ind=0; ind<elements; ind++) | |
| { | |
| orderedArr[ind].val=arr[ind]; | |
| orderedArr[ind].ind=ind; | |
| } | |
| std::qsort(orderedArr, elements, sizeof(ourType), | |
| quickSortComp<ourType>); |
elements is not known at compile time so this is a given.The following code solved the issue:
std::vector<ourType> orderedArr(elements);
for (int ind=0; ind<elements; ind++)
{
orderedArr[ind].val=arr[ind];
orderedArr[ind].ind=ind;
}
std::qsort(orderedArr.data(), elements, sizeof(ourType),
quickSortComp<ourType>);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels