From: Chris Dams Date: Thu, 17 Aug 2006 14:38:38 +0000 (+0000) Subject: Support for exset and printing thereof. X-Git-Tag: release_1-4-0~68 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=98fa99a4c097b9baee1ce09124a24bced4b1abbb;p=ginac.git Support for exset and printing thereof. --- diff --git a/ginac/basic.h b/ginac/basic.h index b08ad669..5fa74d5b 100644 --- a/ginac/basic.h +++ b/ginac/basic.h @@ -25,6 +25,7 @@ #include // for size_t #include +#include #include // CINT needs to work properly with #include @@ -45,6 +46,7 @@ class archive_node; class print_context; typedef std::vector exvector; +typedef std::set exset; typedef std::map exmap; // Define this to enable some statistical output for comparisons and hashing diff --git a/ginac/ex.h b/ginac/ex.h index 574e6800..3070b7ad 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -687,6 +687,7 @@ struct ex_swap : public std::binary_function { // 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 diff --git a/ginac/operators.cpp b/ginac/operators.cpp index 1a1b6de4..d7549659 100644 --- a/ginac/operators.cpp +++ b/ginac/operators.cpp @@ -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);