[Aptitude-svn-commit] r4029 - in branches/aptitude-0.3/aptitude: . src/generic tests

Daniel Burrows dburrows at costa.debian.org
Wed Aug 31 23:29:52 UTC 2005


Author: dburrows
Date: Wed Aug 31 23:29:50 2005
New Revision: 4029

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/immset.h
   branches/aptitude-0.3/aptitude/tests/interactive_set_test.cc
Log:
Use dump() instead of operator overloading to dump the structure of a set.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Wed Aug 31 23:29:50 2005
@@ -1,5 +1,10 @@
 2005-08-31  Daniel Burrows  <dburrows at debian.org>
 
+	* src/generic/immset.h, tests/interactive_set_test.cc:
+
+	  Make the set dump a dump() routine instead of operator<<, since
+	  it's not really suitable as a generic way of displaying a tree.
+
 	* tests/test_wtree.cc:
 
 	  Write a test targetted at the bug that showed up today in

Modified: branches/aptitude-0.3/aptitude/src/generic/immset.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/immset.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/immset.h	Wed Aug 31 23:29:50 2005
@@ -655,6 +655,11 @@
     {
       return root.empty();
     }
+
+    void dump(std::ostream &out) const
+    {
+      root.dump(out);
+    }
   };
 
   /** Compare two sets.  Will produce strange results unless the two
@@ -854,30 +859,12 @@
     {
       return contents == other.contents;
     }
+
+    void dump(std::ostream &out) const
+    {
+      contents.dump(out);
+    }
   };
 };
 
-template<typename T, int w>
-std::ostream &operator<<(std::ostream &out,
-			 const imm::wtree_node<T, w> &n)
-{
-  n.dump(out);
-  return out;
-}
-
-template<typename Val, typename Compare, int w>
-std::ostream &operator<<(std::ostream &out,
-			 const imm::set<Val, Compare, w> &s)
-{
-  s.get_root().dump(out);
-  return out;
-}
-
-template<typename Key, typename Val, typename Compare>
-std::ostream &operator<<(std::ostream &out,
-			 const imm::map<Key, Val, Compare> &m)
-{
-  return out << m.get_contents();
-}
-
 #endif

Modified: branches/aptitude-0.3/aptitude/tests/interactive_set_test.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/tests/interactive_set_test.cc	(original)
+++ branches/aptitude-0.3/aptitude/tests/interactive_set_test.cc	Wed Aug 31 23:29:50 2005
@@ -20,12 +20,14 @@
 	  if(str == "+")
 	    {
 	      s.insert(i);
-	      std::cout << s << std::endl;
+	      s.dump(std::cout);
+	      std::cout << std::endl;
 	    }
 	  else if(str == "-")
 	    {
 	      s.erase(i);
-	      std::cout << s << std::endl;
+	      s.dump(std::cout);
+	      std::cout << std::endl;
 	    }
 	  else
 	    std::cerr << "Enter '+' or '-' followed by a number." << std::endl;



More information about the Aptitude-svn-commit mailing list