add assignement operator to ConstraintTree

This commit is contained in:
Tiago Gomes 2012-10-30 00:15:40 +00:00
parent d07ea73050
commit b6df8a66b1
2 changed files with 16 additions and 3 deletions

View File

@ -187,9 +187,7 @@ ConstraintTree::ConstraintTree (
ConstraintTree::ConstraintTree (const ConstraintTree& ct) ConstraintTree::ConstraintTree (const ConstraintTree& ct)
{ {
root_ = CTNode::copySubtree (ct.root_); *this = ct;
logVars_ = ct.logVars_;
logVarSet_ = ct.logVarSet_;
} }
@ -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 unsigned
ConstraintTree::countTuples (const CTNode* n) const ConstraintTree::countTuples (const CTNode* n) const
{ {

View File

@ -200,6 +200,8 @@ class ConstraintTree
void copyLogVar (LogVar,LogVar); void copyLogVar (LogVar,LogVar);
ConstraintTree& operator= (const ConstraintTree& ct);
private: private:
unsigned countTuples (const CTNode*) const; unsigned countTuples (const CTNode*) const;