INTERSECTION not union
authorCarl N. Baldwin <cnb@Cone.local>
Wed, 26 Oct 2005 03:44:45 +0000 (21:44 -0600)
committerCarl N. Baldwin <cnb@Cone.local>
Wed, 26 Oct 2005 03:44:45 +0000 (21:44 -0600)
main.cpp

index 3a86a2bb2df27c03a56a987ff49419129ec683db..fb7d522798909ef1d6c90533fed9fec48157adcc 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -64,25 +64,25 @@ void partition_sets( const SET &current, const SET &old,
                      SET &added, SET &common, SET &old_common, SET &deleted  ) {
   FileDataNameCmp cmp;
 
-  set_difference( current.begin(), current.end(),
-                  old.begin(),     old.end(),
-                  inserter( added, added.begin() ),
-                  cmp );
-
-  set_difference( old.begin(),     old.end(),
-                  current.begin(), current.end(),
-                  inserter( deleted, deleted.begin() ),
-                  cmp );
-
-  set_union(      current.begin(), current.end(),
-                  old.begin(),     old.end(),
-                  inserter( common, common.begin() ),
-                  cmp );
-
-  set_union(      old.begin(),    old.end(),
-                  common.begin(), common.end(),
-                  inserter( old_common, old_common.begin() ),
-                  cmp );
+  set_difference(   current.begin(), current.end(),
+                    old.begin(),     old.end(),
+                    inserter( added, added.begin() ),
+                    cmp );
+
+  set_difference(   old.begin(),     old.end(),
+                    current.begin(), current.end(),
+                    inserter( deleted, deleted.begin() ),
+                    cmp );
+
+  set_intersection( current.begin(), current.end(),
+                    old.begin(),     old.end(),
+                    inserter( common, common.begin() ),
+                    cmp );
+
+  set_intersection( old.begin(),    old.end(),
+                    common.begin(), common.end(),
+                    inserter( old_common, old_common.begin() ),
+                    cmp );
 }
 
 template<class INT>