Play nice with BOOST_FOREACH: non-const begin/end. Also removed buggy clear().

release/4.3a0
Frank Dellaert 2009-11-23 05:27:19 +00:00
parent 10a8ac34ec
commit 9bac438dbe
1 changed files with 6 additions and 16 deletions

View File

@ -57,25 +57,15 @@ namespace gtsam {
/** Check equality */ /** Check equality */
bool equals(const FactorGraph& fg, double tol = 1e-9) const; bool equals(const FactorGraph& fg, double tol = 1e-9) const;
/** STL like, return the iterator pointing to the first factor */ /** STL begin and end, so we can use BOOST_FOREACH */
inline const_iterator begin() const {
return factors_.begin();
}
/** STL like, return the iterator pointing to the last factor */ inline iterator begin() { return factors_.begin();}
inline const_iterator end() const { inline const_iterator begin() const { return factors_.begin();}
return factors_.end(); inline iterator end() { return factors_.end(); }
} inline const_iterator end() const { return factors_.end(); }
/** clear the factor graph */
inline void clear() {
factors_.clear();
}
/** Get a specific factor by index */ /** Get a specific factor by index */
inline sharedFactor operator[](size_t i) const { inline sharedFactor operator[](size_t i) const {return factors_[i];}
return factors_[i];
}
/** return the number of factors and NULLS */ /** return the number of factors and NULLS */
inline size_t size() const { return factors_.size();} inline size_t size() const { return factors_.size();}