fixed equals

release/4.3a0
Frank Dellaert 2009-11-18 16:30:57 +00:00
parent ceed2ae17d
commit bef2efacb7
1 changed files with 12 additions and 2 deletions

View File

@ -183,12 +183,22 @@ namespace gtsam {
root_->printTree("");
}
/* ************************************************************************* */
// binary predicate to test equality of a pair for use in equals
template<class Conditional>
bool check_pair(
const pair<string,typename BayesTree<Conditional>::sharedClique >& v1,
const pair<string,typename BayesTree<Conditional>::sharedClique >& v2
) {
return v1.first == v2.first && v1.second->equals(*(v2.second));
}
/* ************************************************************************* */
template<class Conditional>
bool BayesTree<Conditional>::equals(const BayesTree<Conditional>& other,
double tol) const {
return size()==other.size();
//&& equal(nodes_.begin(),nodes_.end(),other.nodes_.begin(),equals_star<Clique>(tol));
return size()==other.size() &&
equal(nodes_.begin(),nodes_.end(),other.nodes_.begin(),check_pair<Conditional>);
}
/* ************************************************************************* */