Support for exset and printing thereof.
authorChris Dams <Chris.Dams@mi.infn.it>
Thu, 17 Aug 2006 14:38:38 +0000 (14:38 +0000)
committerChris Dams <Chris.Dams@mi.infn.it>
Thu, 17 Aug 2006 14:38:38 +0000 (14:38 +0000)
ginac/basic.h
ginac/ex.h
ginac/operators.cpp

index b08ad6693472859ccf1645abf889f1558b3f37d2..5fa74d5b6fefddd8a75066b09ea5f6f237e6705c 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <cstddef> // for size_t
 #include <vector>
+#include <set>
 #include <map>
 // CINT needs <algorithm> to work properly with <vector>
 #include <algorithm>
@@ -45,6 +46,7 @@ class archive_node;
 class print_context;
 
 typedef std::vector<ex> exvector;
+typedef std::set<ex, ex_is_less> exset;
 typedef std::map<ex, ex, ex_is_less> exmap;
 
 // Define this to enable some statistical output for comparisons and hashing
index 574e6800774b4b0304f556ffe5ea03426951f890..3070b7ada020d68c917907b77434315b8992c12e 100644 (file)
@@ -687,6 +687,7 @@ struct ex_swap : public std::binary_function<ex, ex, void> {
 
 // Make it possible to print exvectors and exmaps
 std::ostream & operator<<(std::ostream & os, const exvector & e);
+std::ostream & operator<<(std::ostream & os, const exset & e);
 std::ostream & operator<<(std::ostream & os, const exmap & e);
 
 // wrapper functions around member functions
index 1a1b6de497232d0b0cb5b8b34bc23318198ccbc4..d75496593f5b2dd3c1d141ade93b3e441e848566 100644 (file)
@@ -377,6 +377,33 @@ std::ostream & operator<<(std::ostream & os, const exvector & e)
        return os;
 }
 
+std::ostream & operator<<(std::ostream & os, const exset & e)
+{
+       print_context *p = get_print_context(os);
+       exset::const_iterator i = e.begin();
+       exset::const_iterator send = e.end();
+
+       if (i==send) {
+               os << "<>";
+               return os;
+       }
+
+       os << "<";
+       while (true) {
+               if (p == 0)
+                       i->print(print_dflt(os));
+               else
+                       i->print(*p);
+               ++i;
+               if (i == send)
+                       break;
+               os << ",";
+       }
+       os << ">";
+
+       return os;
+}
+
 std::ostream & operator<<(std::ostream & os, const exmap & e)
 {
        print_context *p = get_print_context(os);