From bef2efacb7a21e9cb21e5f6159a8dcd59563c8f8 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Wed, 18 Nov 2009 16:30:57 +0000 Subject: [PATCH] fixed equals --- cpp/BayesTree-inl.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cpp/BayesTree-inl.h b/cpp/BayesTree-inl.h index db35ac75b..8af6db53b 100644 --- a/cpp/BayesTree-inl.h +++ b/cpp/BayesTree-inl.h @@ -183,12 +183,22 @@ namespace gtsam { root_->printTree(""); } + /* ************************************************************************* */ + // binary predicate to test equality of a pair for use in equals + template + bool check_pair( + const pair::sharedClique >& v1, + const pair::sharedClique >& v2 + ) { + return v1.first == v2.first && v1.second->equals(*(v2.second)); + } + /* ************************************************************************* */ template bool BayesTree::equals(const BayesTree& other, double tol) const { - return size()==other.size(); - //&& equal(nodes_.begin(),nodes_.end(),other.nodes_.begin(),equals_star(tol)); + return size()==other.size() && + equal(nodes_.begin(),nodes_.end(),other.nodes_.begin(),check_pair); } /* ************************************************************************* */