@@ -1824,26 +1824,6 @@ pub fn each_permutation<T:Copy>(values: &[T], fun: &fn(perm : &[T]) -> bool) {
18241824 }
18251825}
18261826
1827- /**
1828- * Iterate over all permutations of vector `values`.
1829- *
1830- * This is an alternative to each_permutation that uses references to
1831- * avoid copying the elements of the values vector.
1832- *
1833- * To avoid copying, the iterator will be passed a reference to a vector
1834- * containing references to the elements in the original `values` vector.
1835- *
1836- * # Arguments
1837- *
1838- * * `values` - A vector of values from which the permutations are chosen
1839- *
1840- * * `fun` - The function to iterate over the permutations
1841- */
1842- #[ cfg( not( stage0) ) ]
1843- pub fn each_permutation_ref < T > ( values : & [ T ] , fun : & fn ( perm : & [ & T ] ) -> bool ) {
1844- each_permutation ( vec:: from_fn ( values. len ( ) , |i| & values[ i] ) , fun) ;
1845- }
1846-
18471827/**
18481828 * Iterate over all contiguous windows of length `n` of the vector `v`.
18491829 *
@@ -4827,16 +4807,6 @@ mod tests {
48274807 assert_eq ! ( v, ~[ ~[ ] ] ) ;
48284808 }
48294809
4830- #[ test]
4831- fn test_permutations0_ref ( ) {
4832- let values = [ ] ;
4833- let mut v : ~[ ~[ int ] ] = ~[ ] ;
4834- for each_permutation_ref( values) |p| {
4835- v. push ( p. to_owned ( ) ) ;
4836- }
4837- assert_eq ! ( v, ~[ ~[ ] ] ) ;
4838- }
4839-
48404810 #[ test]
48414811 fn test_permutations1 ( ) {
48424812 let values = [ 1 ] ;
@@ -4847,16 +4817,6 @@ mod tests {
48474817 assert_eq ! ( v, ~[ ~[ 1 ] ] ) ;
48484818 }
48494819
4850- #[ test]
4851- fn test_permutations1_ref ( ) {
4852- let values = [ 1 ] ;
4853- let mut v : ~[ ~[ int ] ] = ~[ ] ;
4854- for each_permutation_ref( values) |p| {
4855- v. push ( p. to_owned ( ) ) ;
4856- }
4857- assert_eq ! ( v, ~[ ~[ 1 ] ] ) ;
4858- }
4859-
48604820 #[ test]
48614821 fn test_permutations2 ( ) {
48624822 let values = [ 1 , 2 ] ;
@@ -4867,16 +4827,6 @@ mod tests {
48674827 assert_eq ! ( v, ~[ ~[ 1 , 2 ] , ~[ 2 , 1 ] ] ) ;
48684828 }
48694829
4870- #[ test]
4871- fn test_permutations2_ref ( ) {
4872- let values = [ 1 , 2 ] ;
4873- let mut v : ~[ ~[ int ] ] = ~[ ] ;
4874- for each_permutation_ref( values) |p| {
4875- v. push ( p. to_owned ( ) ) ;
4876- }
4877- assert_eq ! ( v, ~[ ~[ 1 , 2 ] , ~[ 2 , 1 ] ] ) ;
4878- }
4879-
48804830 #[ test]
48814831 fn test_permutations3 ( ) {
48824832 let values = [ 1 , 2 , 3 ] ;
@@ -4887,16 +4837,6 @@ mod tests {
48874837 assert_eq ! ( v, ~[ ~[ 1 , 2 , 3 ] , ~[ 1 , 3 , 2 ] , ~[ 2 , 1 , 3 ] , ~[ 2 , 3 , 1 ] , ~[ 3 , 1 , 2 ] , ~[ 3 , 2 , 1 ] ] ) ;
48884838 }
48894839
4890- #[ test]
4891- fn test_permutations3_ref ( ) {
4892- let values = [ 1 , 2 , 3 ] ;
4893- let mut v : ~[ ~[ int ] ] = ~[ ] ;
4894- for each_permutation_ref( values) |p| {
4895- v. push ( p. to_owned ( ) ) ;
4896- }
4897- assert_eq ! ( v, ~[ ~[ 1 , 2 , 3 ] , ~[ 1 , 3 , 2 ] , ~[ 2 , 1 , 3 ] , ~[ 2 , 3 , 1 ] , ~[ 3 , 1 , 2 ] , ~[ 3 , 2 , 1 ] ] ) ;
4898- }
4899-
49004840 #[ test]
49014841 fn test_each_val ( ) {
49024842 use old_iter:: CopyableNonstrictIter ;
0 commit comments