Simplify initializer list constructors.
parent
98f3c9676f
commit
b51f176232
|
@ -166,10 +166,8 @@ class FactorGraph {
|
|||
* FactorGraph fg = {make_shared<MyFactor>(), ...};
|
||||
*/
|
||||
template <class DERIVEDFACTOR, typename = IsDerived<DERIVEDFACTOR>>
|
||||
FactorGraph(
|
||||
std::initializer_list<boost::shared_ptr<DERIVEDFACTOR>> sharedFactors) {
|
||||
for (auto&& f : sharedFactors) factors_.push_back(f);
|
||||
}
|
||||
FactorGraph(std::initializer_list<boost::shared_ptr<DERIVEDFACTOR>> sharedFactors)
|
||||
: factors_(sharedFactors) {}
|
||||
|
||||
/// @}
|
||||
/// @name Adding Single Factors
|
||||
|
|
|
@ -92,11 +92,8 @@ namespace gtsam {
|
|||
VectorValues() {}
|
||||
|
||||
/// Construct from initializer list.
|
||||
VectorValues(std::initializer_list<std::pair<Key, Vector>> init) {
|
||||
for (const auto& p : init) {
|
||||
values_.insert(p); // Insert key-value pair into map
|
||||
}
|
||||
}
|
||||
VectorValues(std::initializer_list<std::pair<Key, Vector>> init)
|
||||
: values_(init.begin(), init.end()) {}
|
||||
|
||||
/** Merge two VectorValues into one, this is more efficient than inserting
|
||||
* elements one by one. */
|
||||
|
|
|
@ -64,11 +64,8 @@ namespace gtsam {
|
|||
* Constructor that takes an initializer list of shared pointers.
|
||||
* FactorGraph fg = {make_shared<MyFactor>(), ...};
|
||||
*/
|
||||
SymbolicBayesNet(
|
||||
std::initializer_list<boost::shared_ptr<SymbolicConditional>>
|
||||
sharedFactors) {
|
||||
for (auto&& f : sharedFactors) factors_.push_back(f);
|
||||
}
|
||||
SymbolicBayesNet(std::initializer_list<boost::shared_ptr<SymbolicConditional>> sharedFactors)
|
||||
: Base() {}
|
||||
|
||||
/// Construct from a single conditional
|
||||
SymbolicBayesNet(SymbolicConditional&& c) {
|
||||
|
|
|
@ -91,10 +91,9 @@ namespace gtsam {
|
|||
* Constructor that takes an initializer list of shared pointers.
|
||||
* FactorGraph fg = {make_shared<MyFactor>(), ...};
|
||||
*/
|
||||
SymbolicFactorGraph(std::initializer_list<boost::shared_ptr<SymbolicFactor>>
|
||||
sharedFactors) {
|
||||
for (auto&& f : sharedFactors) factors_.push_back(f);
|
||||
}
|
||||
SymbolicFactorGraph(
|
||||
std::initializer_list<boost::shared_ptr<SymbolicFactor>> sharedFactors)
|
||||
: Base(sharedFactors) {}
|
||||
|
||||
/// Construct from a single factor
|
||||
SymbolicFactorGraph(SymbolicFactor&& c) {
|
||||
|
|
Loading…
Reference in New Issue