Skip to content

Commit 3d54efd

Browse files
thestingergraydon
authored andcommitted
---
yaml --- r: 42462 b: refs/heads/try c: 1aaeda1 h: refs/heads/master v: v3
1 parent a222524 commit 3d54efd

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 90b111f4bf1f63f6dbb0fc048f334cfe02cab0d9
5+
refs/heads/try: 1aaeda1e1eda1ff5a78f92a5e60e93319174528e
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/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)