Added one function emplace_shared
parent
f39cbf736d
commit
3d33b7e2cd
|
@ -33,6 +33,8 @@
|
|||
#include <gtsam/base/FastVector.h>
|
||||
#include <gtsam/inference/Key.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
// Forward declarations
|
||||
|
@ -159,6 +161,12 @@ namespace gtsam {
|
|||
void push_back(const sharedFactor& 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) */
|
||||
template<typename ITERATOR>
|
||||
typename boost::enable_if<boost::is_base_of<FactorType, typename ITERATOR::value_type::element_type> >::type
|
||||
|
@ -355,4 +363,4 @@ namespace gtsam {
|
|||
|
||||
} // namespace gtsam
|
||||
|
||||
#include <gtsam/inference/FactorGraph-inst.h>
|
||||
#include <gtsam/inference/FactorGraph-inst.h>
|
||||
|
|
Loading…
Reference in New Issue