From 158748a96ae87d6d65a7c9eb475a96875c290fd4 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Wed, 18 Sep 2002 17:18:13 +0000 Subject: [PATCH] synced to 1.0 --- ginac/symbol.cpp | 14 ++------------ ginac/symbol.h | 13 +------------ ginac/tensor.cpp | 7 ++++--- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index e393e95d..6a07e2bd 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -32,7 +32,7 @@ namespace GiNaC { -GINAC_IMPLEMENT_REGISTERED_CLASS_NO_CTORS(symbol, basic) +GINAC_IMPLEMENT_REGISTERED_CLASS(symbol, basic) ////////// // default ctor, dtor, copy ctor, assignment operator and helpers @@ -53,7 +53,7 @@ void symbol::copy(const symbol & other) TeX_name = other.TeX_name; serial = other.serial; asexinfop = other.asexinfop; - ++asexinfop->refcount; + ++(asexinfop->refcount); } void symbol::destroy(bool call_parent) @@ -70,11 +70,6 @@ void symbol::destroy(bool call_parent) // public -symbol::symbol(const symbol & other) -{ - copy(other); -} - symbol::symbol(const std::string & initname) : inherited(TINFO_symbol) { name = initname; @@ -137,11 +132,6 @@ void symbol::archive(archive_node &n) const // public -basic *symbol::duplicate() const -{ - return new symbol(*this); -} - void symbol::print(const print_context & c, unsigned level) const { if (is_a(c)) { diff --git a/ginac/symbol.h b/ginac/symbol.h index 7c96312c..15490253 100644 --- a/ginac/symbol.h +++ b/ginac/symbol.h @@ -37,7 +37,7 @@ namespace GiNaC { * first place. */ class symbol : public basic { - GINAC_DECLARE_REGISTERED_CLASS_NO_CTORS(symbol, basic) + GINAC_DECLARE_REGISTERED_CLASS(symbol, basic) // types @@ -52,15 +52,6 @@ class symbol : public basic // member functions - // default ctor, dtor, copy ctor, assignment operator and helpers -public: - symbol(); - ~symbol() { destroy(false); } - symbol(const symbol & other); -protected: - void copy(const symbol & other); - void destroy(bool call_parent); - // other ctors public: explicit symbol(const std::string & initname); @@ -68,7 +59,6 @@ public: // functions overriding virtual functions from base classes public: - basic * duplicate() const; void print(const print_context & c, unsigned level = 0) const; bool info(unsigned inf) const; ex eval(int level = 0) const; @@ -78,7 +68,6 @@ public: ex to_rational(lst &repl_lst) const; protected: ex derivative(const symbol & s) const; - int compare_same_type(const basic & other) const; bool is_equal_same_type(const basic & other) const; unsigned calchash(void) const; diff --git a/ginac/tensor.cpp b/ginac/tensor.cpp index a1daf625..4d514d14 100644 --- a/ginac/tensor.cpp +++ b/ginac/tensor.cpp @@ -349,8 +349,8 @@ again: try { // minimal_dim() throws an exception when index dimensions are not comparable ex min_dim = self_idx->minimal_dim(other_idx); - *self = _ex1; *other = other->subs(other_idx == free_idx->replace_dim(min_dim)); + *self = _ex1; // *other is assigned first because assigning *self invalidates free_idx return true; } catch (std::exception &e) { return false; @@ -460,9 +460,10 @@ again: if (is_dummy_pair(*self_idx, other_idx)) { // Contraction found, remove metric tensor and substitute - // index in second object - *self = (static_cast(self_idx)->is_covariant() ? sign : -sign); + // index in second object (assign *self last because this + // invalidates free_idx) *other = other->subs(other_idx == *free_idx); + *self = (static_cast(self_idx)->is_covariant() ? sign : -sign); return true; } } -- 2.49.0