Purpose: I am trying to sort only a range of values in an array of struct (the struct has two fields and I want to sort on one of its fields using myComp function below). However, I am getting this error:

../src/phobos/std/algorithm.d(7731): Error: cannot implicitly convert expression (assumeSorted(r)) of type SortedRange!(shared(intpair)[], myComp) to SortedRange!(shared(intpair[]), myComp) ./ParallelCode.d(223): Error: template instance ParallelCode.singleSlave.sort!(myComp, cast(SwapStrategy)0, shared(intpair[])) error instantiating
=================================
where my relevant code is:
=================================


struct intpair{
  int AllInts[2];
};
shared intpair [] distArray;

void main()
{
...
distArray = new shared intpair[number_of_lines];
...
}

void singleThreadFunction(...)
{
 bool myComp(shared intpair x,shared intpair y)
   {
     return x.AllInts[0] < y.AllInts[0];
   }
shared intpair[] tempSortArray = distArray[startRange..endRange+1];

/*line 223:*/   sort!(myComp)(tempSortArray);

}

Can you please help me. Thanks.

Reply via email to