From 0a842cf0ec1cd5d1b306ef95cbd464b9e78233b2 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Thu, 2 Feb 2012 22:45:41 +0000 Subject: [PATCH] Added empty() to graphs --- gtsam/inference/FactorGraph.h | 3 +++ 1 file changed, 3 insertions(+) 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_; }