Parallel Merge Sort

Josh via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 4 14:18:01 PST 2015


> Bye,
> bearophile

Believe me I just don't post on here without first trying to 
answer the question on my own.

I was already on the std.algorithm and found this:

Swaps lhs and rhs. The instances lhs and rhs are moved in memory, 
without ever calling opAssign, nor any other function. T need not 
be assignable at all to be swapped.
If lhs and rhs reference the same instance, then nothing is done.
lhs and rhs must be mutable. If T is a struct or union, then its 
fields must also all be (recursivelly) mutable.

now say A[] was = [90, 50, 33, 72, 35]

and by the end of the function B[] = [33, 50, 72, 90, 35]


now we call swap(A,B) and A would now = [33, 35, 50, 72, 90]

and somehow the 35 moves in front of the 50.


More information about the Digitalmars-d mailing list