error checking for find operation on map

release/4.3a0
Manohar Paluri 2009-08-28 14:35:02 +00:00
parent b530c97b08
commit 017ad6a66f
2 changed files with 2 additions and 1 deletions

View File

@ -53,6 +53,7 @@ boost::shared_ptr<FGConfig> ChordalBayesNet::optimize(const boost::shared_ptr<FG
/** solve each node in turn in topological sort order (parents first)*/ /** solve each node in turn in topological sort order (parents first)*/
BOOST_FOREACH(string key, keys) { BOOST_FOREACH(string key, keys) {
const_iterator cg = nodes.find(key); // get node const_iterator cg = nodes.find(key); // get node
assert( cg != nodes.end() );
Vector x = cg->second->solve(*result); // Solve it Vector x = cg->second->solve(*result); // Solve it
result->insert(key,x); // store result in partial solution result->insert(key,x); // store result in partial solution
} }

View File

@ -112,7 +112,7 @@ namespace gtsam {
/** /**
* adds a parent * adds a parent
*/ */
void add(std::string key, Matrix S){ parents_.insert(make_pair(key, S)); } void add(const std::string key, Matrix S){ parents_.insert(make_pair(key, S)); }
/** equals function */ /** equals function */
bool equals(const ConditionalGaussian &cg) const; bool equals(const ConditionalGaussian &cg) const;