Added one function emplace_shared
parent
f39cbf736d
commit
3d33b7e2cd
|
@ -33,6 +33,8 @@
|
||||||
#include <gtsam/base/FastVector.h>
|
#include <gtsam/base/FastVector.h>
|
||||||
#include <gtsam/inference/Key.h>
|
#include <gtsam/inference/Key.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
// Forward declarations
|
// Forward declarations
|
||||||
|
@ -159,6 +161,12 @@ namespace gtsam {
|
||||||
void push_back(const sharedFactor& factor) {
|
void push_back(const sharedFactor& factor) {
|
||||||
factors_.push_back(factor); }
|
factors_.push_back(factor); }
|
||||||
|
|
||||||
|
/** Emplace a factor */
|
||||||
|
template<class DERIVEDFACTOR, class... Args>
|
||||||
|
void emplace_shared(Args&&... args) {
|
||||||
|
factors_.push_back(boost::make_shared<DERIVEDFACTOR>(std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
/** push back many factors with an iterator over shared_ptr (factors are not copied) */
|
/** push back many factors with an iterator over shared_ptr (factors are not copied) */
|
||||||
template<typename ITERATOR>
|
template<typename ITERATOR>
|
||||||
typename boost::enable_if<boost::is_base_of<FactorType, typename ITERATOR::value_type::element_type> >::type
|
typename boost::enable_if<boost::is_base_of<FactorType, typename ITERATOR::value_type::element_type> >::type
|
||||||
|
|
Loading…
Reference in New Issue