diff --git a/cpp/LinearFactor.cpp b/cpp/LinearFactor.cpp index def369a13..a016a9f36 100644 --- a/cpp/LinearFactor.cpp +++ b/cpp/LinearFactor.cpp @@ -287,13 +287,13 @@ void LinearFactor::append_factor(LinearFactor::shared_ptr f, const size_t m, */ /* ************************************************************************* */ pair -LinearFactor::eliminate(const string& key) +LinearFactor::eliminate(const string& key) const { bool verbose = false; if (verbose) cout << "LinearFactor::eliminate(" << key << ")" << endl; // if this factor does not involve key, we exit with empty CG and LF - iterator it = As_.find(key); + const_iterator it = As_.find(key); if (it==As_.end()) { // Conditional Gaussian is just a parent-less node with P(x)=1 LinearFactor::shared_ptr lf(new LinearFactor); diff --git a/cpp/LinearFactor.h b/cpp/LinearFactor.h index 18f932612..c60eb9769 100644 --- a/cpp/LinearFactor.h +++ b/cpp/LinearFactor.h @@ -232,7 +232,8 @@ public: * @param key the key of the node to be eliminated * @return a new factor and a conditional gaussian on the eliminated variable */ - std::pair, shared_ptr> eliminate(const std::string& key); + std::pair, shared_ptr> + eliminate(const std::string& key) const; /** * Take the factor f, and append to current matrices. Not very general.