diff --git a/packages/CLPBN/horus/ConstraintTree.cpp b/packages/CLPBN/horus/ConstraintTree.cpp index 07aaf35a3..59705e1e1 100644 --- a/packages/CLPBN/horus/ConstraintTree.cpp +++ b/packages/CLPBN/horus/ConstraintTree.cpp @@ -187,9 +187,7 @@ ConstraintTree::ConstraintTree ( ConstraintTree::ConstraintTree (const ConstraintTree& ct) { - root_ = CTNode::copySubtree (ct.root_); - logVars_ = ct.logVars_; - logVarSet_ = ct.logVarSet_; + *this = ct; } @@ -875,6 +873,19 @@ ConstraintTree::copyLogVar (LogVar X_1, LogVar X_2) +ConstraintTree& +ConstraintTree::operator= (const ConstraintTree& ct) +{ + if (this != &ct) { + root_ = CTNode::copySubtree (ct.root_); + logVars_ = ct.logVars_; + logVarSet_ = ct.logVarSet_; + } + return *this; +} + + + unsigned ConstraintTree::countTuples (const CTNode* n) const { diff --git a/packages/CLPBN/horus/ConstraintTree.h b/packages/CLPBN/horus/ConstraintTree.h index d233a2e97..071a96a5e 100644 --- a/packages/CLPBN/horus/ConstraintTree.h +++ b/packages/CLPBN/horus/ConstraintTree.h @@ -199,6 +199,8 @@ class ConstraintTree ConstraintTrees ground (LogVar); void copyLogVar (LogVar,LogVar); + + ConstraintTree& operator= (const ConstraintTree& ct); private: unsigned countTuples (const CTNode*) const;