From 9bac438dbed2f3085f1b4ac0abb93149702593f4 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Mon, 23 Nov 2009 05:27:19 +0000 Subject: [PATCH] Play nice with BOOST_FOREACH: non-const begin/end. Also removed buggy clear(). --- cpp/FactorGraph.h | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/cpp/FactorGraph.h b/cpp/FactorGraph.h index 7b78d5fc8..21b9d26c0 100644 --- a/cpp/FactorGraph.h +++ b/cpp/FactorGraph.h @@ -57,25 +57,15 @@ namespace gtsam { /** Check equality */ bool equals(const FactorGraph& fg, double tol = 1e-9) const; - /** STL like, return the iterator pointing to the first factor */ - inline const_iterator begin() const { - return factors_.begin(); - } + /** STL begin and end, so we can use BOOST_FOREACH */ - /** STL like, return the iterator pointing to the last factor */ - inline const_iterator end() const { - return factors_.end(); - } - - /** clear the factor graph */ - inline void clear() { - factors_.clear(); - } + inline iterator begin() { return factors_.begin();} + inline const_iterator begin() const { return factors_.begin();} + inline iterator end() { return factors_.end(); } + inline const_iterator end() const { return factors_.end(); } /** Get a specific factor by index */ - inline sharedFactor operator[](size_t i) const { - return factors_[i]; - } + inline sharedFactor operator[](size_t i) const {return factors_[i];} /** return the number of factors and NULLS */ inline size_t size() const { return factors_.size();}