diff --git a/examples/Hybrid_City10000.cpp b/examples/Hybrid_City10000.cpp index f42496cef..76771ad36 100644 --- a/examples/Hybrid_City10000.cpp +++ b/examples/Hybrid_City10000.cpp @@ -127,7 +127,7 @@ class Experiment { auto bayesNet = linearized->eliminateSequential(); HybridValues delta = bayesNet->optimize(); initial_ = initial_.retract(delta.continuous()); - smoother_.reInitialize(*bayesNet); + smoother_.reInitialize(std::move(*bayesNet)); clock_t afterUpdate = clock(); std::cout << "Took " << (afterUpdate - beforeUpdate) / CLOCKS_PER_SEC << " seconds." << std::endl; diff --git a/gtsam/hybrid/HybridSmoother.h b/gtsam/hybrid/HybridSmoother.h index 017b1fb4e..f8eaec26c 100644 --- a/gtsam/hybrid/HybridSmoother.h +++ b/gtsam/hybrid/HybridSmoother.h @@ -49,8 +49,16 @@ class GTSAM_EXPORT HybridSmoother { /** * Re-initialize the smoother from a new hybrid Bayes Net. */ + void reInitialize(HybridBayesNet&& hybridBayesNet) { + hybridBayesNet_ = std::move(hybridBayesNet); + } + + /** + * Re-initialize the smoother from + * a new hybrid Bayes Net (non rvalue version). + */ void reInitialize(HybridBayesNet& hybridBayesNet) { - hybridBayesNet_ = hybridBayesNet; + this->reInitialize(std::move(hybridBayesNet)); } /**