On Friday, 25 September 2015 at 02:37:22 UTC, TheGag96 wrote:
So I'm just doing a small test program here:
http://pastebin.com/UYf2n6bP
(I'm making sure I know quicksort for my algorithms class, I
know functionally this won't work as-is)
I'm on Linux, 64-bit, DMD 2.068.1, and when I try to
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..$]);
So I'm just doing a small test program here:
http://pastebin.com/UYf2n6bP
(I'm making sure I know quicksort for my algorithms class, I know
functionally this won't work as-is)
I'm on Linux, 64-bit, DMD 2.068.1, and when I try to compile this
I'm getting:
quicksort.d(18): Error: function
On Friday, 25 September 2015 at 02:37:22 UTC, TheGag96 wrote:
What's the problem here? I SWEAR I've passed arrays by
reference before just like this. Thanks guys.
I'm seeing the same error, but I haven't yet determined why. At
any rate, this works:
```
import std.stdio;
void append(ref
1 class Test
2 {
3 int[][] array;
4 this(ref int[][] d)
5 {
6 array = d;
7 }
8
9 }
10
11 void main()
12 {
13 Test t = new Test([[1,1],[1,1]]); //does not compile
14 }
15
what is the best way to pass a literal ([[1,2],[3,4]]) by
reference?
On Thursday, 24 July 2014 at 16:06:00 UTC, Rishub Nagpal wrote:
1 class Test
2 {
3 int[][] array;
4 this(ref int[][] d)
5 {
6 array = d;
7 }
8
9 }
10
11 void main()
12 {
13 Test t = new Test([[1,1],[1,1]]); //does not compile
14 }
15
what