From 57e1b1e3e188c9ad22ef891cdd38e83a094ece39 Mon Sep 17 00:00:00 2001
From: "Carl N. Baldwin" <cnb@Cone.local>
Date: Tue, 25 Oct 2005 21:44:45 -0600
Subject: [PATCH] INTERSECTION not union

---
 main.cpp | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/main.cpp b/main.cpp
index 3a86a2b..fb7d522 100644
--- 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>
-- 
2.34.1