From 3d33b7e2cd4f2aa5b224d6eb4723388b4cffeb8f Mon Sep 17 00:00:00 2001 From: Yao Chen Date: Wed, 10 Aug 2016 22:07:05 -0400 Subject: [PATCH] Added one function emplace_shared --- gtsam/inference/FactorGraph.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gtsam/inference/FactorGraph.h b/gtsam/inference/FactorGraph.h index 38f30f5a3..604de632c 100644 --- a/gtsam/inference/FactorGraph.h +++ b/gtsam/inference/FactorGraph.h @@ -33,6 +33,8 @@ #include #include +#include + namespace gtsam { // Forward declarations @@ -159,6 +161,12 @@ namespace gtsam { void push_back(const sharedFactor& factor) { factors_.push_back(factor); } + /** Emplace a factor */ + template + void emplace_shared(Args&&... args) { + factors_.push_back(boost::make_shared(std::forward(args)...)); + } + /** push back many factors with an iterator over shared_ptr (factors are not copied) */ template typename boost::enable_if >::type @@ -355,4 +363,4 @@ namespace gtsam { } // namespace gtsam -#include \ No newline at end of file +#include