I am having trouble to compile the following piece of code:
|
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>);
I am having trouble to compile the following piece of code:
NiftySeg/seg-lib/_seg_tools.h
Lines 124 to 131 in 16cf563
elementsis not known at compile time so this is a given.The following code solved the issue: