diff --git a/inference/Conditional.h b/inference/Conditional.h index 1ddd29907..dc2b09587 100644 --- a/inference/Conditional.h +++ b/inference/Conditional.h @@ -68,11 +68,12 @@ public: /** Constructor from a frontal variable and an iterator range of parents */ template - static Conditional::shared_ptr FromRange(Index key, Iterator firstParent, Iterator lastParent) : nrFrontals_(1) { + static Conditional::shared_ptr FromRange(Index key, Iterator firstParent, Iterator lastParent) { Conditional::shared_ptr conditional(new Conditional); + conditional->nrFrontals_ = 1; conditional->keys_.push_back(key); - std::copy(firstKey, lastKey, back_inserter(conditional->keys_)); - return ret; + std::copy(firstParent, lastParent, back_inserter(conditional->keys_)); + return conditional; } /** Named constructor from any number of frontal variables and parents */ diff --git a/inference/inference.cpp b/inference/inference.cpp index 23732cf8c..f14f2e5ab 100644 --- a/inference/inference.cpp +++ b/inference/inference.cpp @@ -72,7 +72,7 @@ Inference::EliminateOneSymbolic(FactorGraph& factorGraph, VariableIndex< // Join the factors and eliminate the variable from the joint factor tic("EliminateOne: Combine"); - Conditional::shared_ptr conditional = Conditional::fromRange(involvedKeys.begin(), involvedKeys.end(), 1); + Conditional::shared_ptr conditional = Conditional::FromRange(involvedKeys.begin(), involvedKeys.end(), 1); Factor::shared_ptr eliminated(new Factor(conditional->beginParents(), conditional->endParents())); toc("EliminateOne: Combine");