]> www.ginac.de Git - ginac.git/blobdiff - ginac/add.cpp
- pseries::print(): did not insert parenthesis when needed for precedence.
[ginac.git] / ginac / add.cpp
index 40ccc23f526553cef1a3849fae2ce39eff337702..d999a1004f39735ccd80eeba03a04016c01519df 100644 (file)
@@ -50,7 +50,7 @@ add::add()
 add::~add()
 {
        debugmsg("add destructor",LOGLEVEL_DESTRUCT);
-       destroy(0);
+       destroy(false);
 }
 
 add::add(const add & other)
@@ -63,7 +63,7 @@ const add & add::operator=(const add & other)
 {
        debugmsg("add operator=",LOGLEVEL_ASSIGNMENT);
        if (this != &other) {
-               destroy(1);
+               destroy(true);
                copy(other);
        }
        return *this;
@@ -206,7 +206,7 @@ void add::print(std::ostream & os, unsigned upper_precedence) const
                        first = false;
                }
                if (!coeff.is_equal(_num1()) &&
-                       !coeff.is_equal(_num_1())) {
+                   !coeff.is_equal(_num_1())) {
                        if (coeff.is_rational()) {
                                if (coeff.is_negative())
                                        os << -coeff;
@@ -220,7 +220,7 @@ void add::print(std::ostream & os, unsigned upper_precedence) const
                        }
                        os << '*';
                }
-               os << cit->rest;
+               cit->rest.print(os, precedence);
        }
        if (precedence<=upper_precedence) os << ")";
 }
@@ -350,7 +350,7 @@ ex add::coeff(const symbol & s, int n) const
        epvector::const_iterator it=seq.begin();
        while (it!=seq.end()) {
                coeffseq.push_back(combine_ex_with_coeff_to_pair((*it).rest.coeff(s,n),
-                                                                                                                (*it).coeff));
+                                                                (*it).coeff));
                ++it;
        }
        if (n==0) {
@@ -370,7 +370,7 @@ ex add::eval(int level) const
        if (evaled_seqp!=0) {
                // do more evaluation later
                return (new add(evaled_seqp,overall_coeff))->
-                                  setflag(status_flags::dynallocated);
+                      setflag(status_flags::dynallocated);
        }
        
 #ifdef DO_GINAC_ASSERT
@@ -539,9 +539,7 @@ ex add::expand(unsigned options) const
        if (vp==0)
                return *this;
        
-       return (new add(vp,overall_coeff))->
-               setflag(status_flags::expanded |
-                               status_flags::dynallocated);
+       return (new add(vp,overall_coeff))->setflag(status_flags::expanded | status_flags::dynallocated);
 }
 
 //////////
@@ -569,7 +567,7 @@ unsigned add::precedence = 40;
 //////////
 
 const add some_add;
-const type_info & typeid_add = typeid(some_add);
+const std::type_info & typeid_add = typeid(some_add);
 
 #ifndef NO_NAMESPACE_GINAC
 } // namespace GiNaC