Skip to content

Commit 9defec7

Browse files
thestingergraydon
authored andcommitted
---
yaml --- r: 52344 b: refs/heads/dist-snap c: 1aaeda1 h: refs/heads/master v: v3
1 parent df153ef commit 9defec7

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 90b111f4bf1f63f6dbb0fc048f334cfe02cab0d9
10+
refs/heads/dist-snap: 1aaeda1e1eda1ff5a78f92a5e60e93319174528e
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libstd/treemap.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,13 @@ impl <T: Ord> TreeSet<T> {
229229
/// Return true if the set has no elements in common with `other`.
230230
/// This is equivalent to checking for an empty intersection.
231231
pure fn is_disjoint(&self, other: &TreeSet<T>) -> bool {
232-
// FIXME: this is a naive O(n*log(m)) implementation, could be O(n)
232+
// FIXME: this is a naive O(n*log(m)) implementation, could be O(n + m)
233233
!iter::any(self, |x| other.contains(x))
234234
}
235235

236236
/// Check of the set is a subset of another
237237
pure fn is_subset(&self, other: &TreeSet<T>) -> bool {
238-
// FIXME: this is a naive O(n*log(m)) implementation, could be O(n)
238+
// FIXME: this is a naive O(n*log(m)) implementation, could be O(n + m)
239239
!iter::any(self, |x| !other.contains(x))
240240
}
241241

@@ -278,14 +278,21 @@ impl <T: Ord> TreeSet<T> {
278278
}
279279

280280
/// Visit the values (in-order) representing the symmetric difference
281-
pure fn symmetric_difference(&self, _other: &TreeSet<T>,
281+
pure fn symmetric_difference(&self, other: &TreeSet<T>,
282282
_f: fn(&T) -> bool) {
283+
unsafe { // purity workaround
284+
let mut x = self.map.iter();
285+
let mut y = other.map.iter();
286+
287+
let mut a = x.next();
288+
let mut b = y.next();
289+
}
283290
fail ~"not yet implemented"
284291
}
285292

286293
/// Visit the values (in-order) representing the intersection
287294
pure fn intersection(&self, other: &TreeSet<T>, f: fn(&T) -> bool) {
288-
// FIXME: this is a naive O(n*log(m)) implementation, could be O(n)
295+
// FIXME: this is a naive O(n*log(m)) implementation, could be O(n + m)
289296
for self.each |x| {
290297
if other.contains(x) {
291298
if !f(x) { break }
@@ -294,7 +301,14 @@ impl <T: Ord> TreeSet<T> {
294301
}
295302

296303
/// Visit the values (in-order) representing the union
297-
pure fn union(&self, _other: &TreeSet<T>, _f: fn(&T) -> bool) {
304+
pure fn union(&self, other: &TreeSet<T>, _f: fn(&T) -> bool) {
305+
unsafe { // purity workaround
306+
let mut x = self.map.iter();
307+
let mut y = other.map.iter();
308+
309+
let mut a = x.next();
310+
let mut b = y.next();
311+
}
298312
fail ~"not yet implemented"
299313
}
300314
}

0 commit comments

Comments
 (0)