diff --git a/gtsam/inference/FactorGraph.h b/gtsam/inference/FactorGraph.h index 458588b7b..12855e0c0 100644 --- a/gtsam/inference/FactorGraph.h +++ b/gtsam/inference/FactorGraph.h @@ -138,6 +138,9 @@ template class BayesTree; /** return the number of factors and NULLS */ size_t size() const { return factors_.size();} + /** Simple check for an empty graph - faster than comparing size() to zero */ + bool empty() const { return factors_.empty(); } + /** const cast to the underlying vector of factors */ operator const std::vector&() const { return factors_; }