Templated binary predicate [equals] for use with STL's equal(...)

release/4.3a0
Frank Dellaert 2009-10-31 14:11:48 +00:00
parent 53890c4ba6
commit b9ceca7dc6
1 changed files with 19 additions and 0 deletions

View File

@ -8,6 +8,8 @@
#pragma once
#include <boost/shared_ptr.hpp>
namespace gtsam {
/**
@ -49,4 +51,21 @@ namespace gtsam {
return false;
}
/**
* Template to create a binary predicate
*/
template<class V>
bool equals(const V& expected, const V& actual, double tol = 1e-9) {
return (actual.equals(expected, tol));
}
/**
* Binary predicate on shared pointers
*/
template<class V>
bool equals_star(const boost::shared_ptr<V>& expected,
const boost::shared_ptr<V>& actual, double tol = 1e-9) {
return (actual->equals(*expected, tol));
}
} // gtsam