Skip to content

Commit 683d9a4

Browse files
committed
---
yaml --- r: 57788 b: refs/heads/incoming c: 91fb7b2 h: refs/heads/master v: v3
1 parent 23db7f1 commit 683d9a4

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: bf67eb2362b7d0f37012f2d6dac604c3bbacd2c6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 92bf9b68da05504e925e2b66ceb9f3e5f1a5b0ee
9+
refs/heads/incoming: 91fb7b282de4877e72f22f42b4535e3c76732264
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libcore/vec.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,16 @@ pub fn each_permutation<T:Copy>(v: &[T], put: &fn(ts: &[T]) -> bool) {
15661566
}
15671567
}
15681568
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+
15691579
/**
15701580
* Iterate over all contiguous windows of length `n` of the vector `v`.
15711581
*
@@ -1580,14 +1590,6 @@ pub fn each_permutation<T:Copy>(v: &[T], put: &fn(ts: &[T]) -> bool) {
15801590
* ~~~
15811591
*
15821592
*/
1583-
#[cfg(stage0)] // XXX: lifetimes!
1584-
pub fn windowed<T>(n: uint, v: &[T], it: &fn(&[T]) -> bool) {
1585-
assert!(1u <= 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-
}
15911593
#[cfg(stage1)]
15921594
#[cfg(stage2)]
15931595
#[cfg(stage3)]

0 commit comments

Comments
 (0)