File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
branches/auto/src/libcore Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
14
14
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
15
15
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
16
16
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17
- refs/heads/auto: 92bf9b68da05504e925e2b66ceb9f3e5f1a5b0ee
17
+ refs/heads/auto: 91fb7b282de4877e72f22f42b4535e3c76732264
18
18
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
19
19
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
Original file line number Diff line number Diff line change @@ -1566,6 +1566,16 @@ pub fn each_permutation<T:Copy>(v: &[T], put: &fn(ts: &[T]) -> bool) {
1566
1566
}
1567
1567
}
1568
1568
1569
+ // see doc below
1570
+ #[cfg(stage0)] // XXX: lifetimes!
1571
+ pub fn windowed<T>(n: uint, v: &[T], it: &fn(&[T]) -> bool) {
1572
+ assert!(1u <= n);
1573
+ if n > v.len() { return; }
1574
+ for uint::range(0, v.len() - n + 1) |i| {
1575
+ if !it(v.slice(i, i+n)) { return }
1576
+ }
1577
+ }
1578
+
1569
1579
/**
1570
1580
* Iterate over all contiguous windows of length `n` of the vector `v`.
1571
1581
*
@@ -1580,14 +1590,6 @@ pub fn each_permutation<T:Copy>(v: &[T], put: &fn(ts: &[T]) -> bool) {
1580
1590
* ~~~
1581
1591
*
1582
1592
* /
1583
- #[ cfg ( stage0) ] // XXX: lifetimes!
1584
- pub fn windowed<T >( n: uint, v: & [ T ] , it: & fn ( & [ T ] ) -> bool) {
1585
- assert ! ( 1 u <= n) ;
1586
- if n > v. len ( ) { return ; }
1587
- for uint:: range( 0 , v. len( ) - n + 1 ) |i| {
1588
- if !it ( v. slice ( i, i+n) ) { return }
1589
- }
1590
- }
1591
1593
#[ cfg ( stage1) ]
1592
1594
#[ cfg( stage2) ]
1593
1595
#[ cfg( stage3) ]
You can’t perform that action at this time.
0 commit comments