… | |
… | |
28 | =cut |
28 | =cut |
29 | |
29 | |
30 | package Array::Heap; |
30 | package Array::Heap; |
31 | |
31 | |
32 | BEGIN { |
32 | BEGIN { |
33 | $VERSION = 3.1; |
33 | $VERSION = 3.2; |
34 | |
34 | |
35 | require XSLoader; |
35 | require XSLoader; |
36 | XSLoader::load ("Array::Heap", $VERSION); |
36 | XSLoader::load ("Array::Heap", $VERSION); |
37 | } |
37 | } |
38 | |
38 | |
… | |
… | |
160 | will sort according to the first element of the arrays, i.e. C<1,2,3>. |
160 | will sort according to the first element of the arrays, i.e. C<1,2,3>. |
161 | |
161 | |
162 | The custom comparison functions work similar to how C<sort> works: C<$a> |
162 | The custom comparison functions work similar to how C<sort> works: C<$a> |
163 | and C<$b> are set to the elements to be compared, and the result should be |
163 | and C<$b> are set to the elements to be compared, and the result should be |
164 | greater than zero then $a is greater than $b, C<0> otherwise. This means |
164 | greater than zero then $a is greater than $b, C<0> otherwise. This means |
165 | that you cna use the same function as for sorting the array, but you could |
165 | that you can use the same function as for sorting the array, but you could |
166 | also use a simpler function that just does C<< $a > $b >>. |
166 | also use a simpler function that just does C<< $a > $b >>. |
167 | |
167 | |
168 | The first example above corresponds to this comparison "function": |
168 | The first example above corresponds to this comparison "function": |
169 | |
169 | |
170 | { $a <=> $b } |
170 | { $a <=> $b } |