]> www.ginac.de Git - ginac.git/blobdiff - ginac/constant.cpp
- removed manual basepointer-fiddling in construct-on-first-use objects
[ginac.git] / ginac / constant.cpp
index 22923855b4f90d232b0ccc6e661d848bec8fc9a0..60c3be247dea1e47c2123d37921026e5fca523de 100644 (file)
@@ -131,7 +131,7 @@ void constant::archive(archive_node &n) const
 }
 
 //////////
-// functions overriding virtual functions from bases classes
+// functions overriding virtual functions from base classes
 //////////
 
 // public
@@ -191,18 +191,20 @@ ex constant::derivative(const symbol & s) const
 int constant::compare_same_type(const basic & other) const
 {
        GINAC_ASSERT(is_exactly_of_type(other, constant));
-       // const constant & o=static_cast<constant &>(const_cast<basic &>(other));
-       // return name.compare(o.name);
-       const constant *o = static_cast<const constant *>(&other);
-       if (serial==o->serial) return 0;
-       return serial < o->serial ? -1 : 1;
+       const constant &o = static_cast<const constant &>(other);
+
+       if (serial == o.serial)
+               return 0;
+       else
+               return serial < o.serial ? -1 : 1;
 }
 
 bool constant::is_equal_same_type(const basic & other) const
 {
        GINAC_ASSERT(is_exactly_of_type(other, constant));
-       const constant *o = static_cast<const constant *>(&other);
-       return serial==o->serial;
+       const constant &o = static_cast<const constant &>(other);
+
+       return serial == o.serial;
 }
 
 unsigned constant::calchash(void) const