@@ -1824,26 +1824,6 @@ pub fn each_permutation<T:Copy>(values: &[T], fun: &fn(perm : &[T]) -> bool) {
1824
1824
}
1825
1825
}
1826
1826
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
-
1847
1827
/**
1848
1828
* Iterate over all contiguous windows of length `n` of the vector `v`.
1849
1829
*
@@ -4827,16 +4807,6 @@ mod tests {
4827
4807
assert_eq ! ( v, ~[ ~[ ] ] ) ;
4828
4808
}
4829
4809
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
-
4840
4810
#[ test]
4841
4811
fn test_permutations1 ( ) {
4842
4812
let values = [ 1 ] ;
@@ -4847,16 +4817,6 @@ mod tests {
4847
4817
assert_eq ! ( v, ~[ ~[ 1 ] ] ) ;
4848
4818
}
4849
4819
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
-
4860
4820
#[ test]
4861
4821
fn test_permutations2 ( ) {
4862
4822
let values = [ 1 , 2 ] ;
@@ -4867,16 +4827,6 @@ mod tests {
4867
4827
assert_eq ! ( v, ~[ ~[ 1 , 2 ] , ~[ 2 , 1 ] ] ) ;
4868
4828
}
4869
4829
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
-
4880
4830
#[ test]
4881
4831
fn test_permutations3 ( ) {
4882
4832
let values = [ 1 , 2 , 3 ] ;
@@ -4887,16 +4837,6 @@ mod tests {
4887
4837
assert_eq ! ( v, ~[ ~[ 1 , 2 , 3 ] , ~[ 1 , 3 , 2 ] , ~[ 2 , 1 , 3 ] , ~[ 2 , 3 , 1 ] , ~[ 3 , 1 , 2 ] , ~[ 3 , 2 , 1 ] ] ) ;
4888
4838
}
4889
4839
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
-
4900
4840
#[ test]
4901
4841
fn test_each_val ( ) {
4902
4842
use old_iter:: CopyableNonstrictIter ;
0 commit comments