On 09/24/2015 09:14 PM, Mike Parker wrote:

> I'm seeing the same error, but I haven't yet determined why.

It is because rvalues cannot be bound to 'ref' parameters:

void quickSort(ref int[] arr) {
// ...

  quickSort(arr[0..wall]);      // This slice is rvalue
  quickSort(arr[wall+1..$]);    // ditto
}

As it has already been said, there is no reason for the ref for this function but the compilation error can be removed by making them lvalues:

  auto left = arr[0..wall];       // now lvalue
  quickSort(left);

  auto right = arr[wall+1..$];    // ditto
  quickSort(right);

Then it will expose another problem with the code. ;)

Ali

Reply via email to