use double dispatch for else case
parent
8390ffa2cb
commit
bc63cc8cb8
|
@ -70,6 +70,9 @@ namespace gtsam {
|
|||
result = std::make_shared<TableFactor>((*tf) * TableFactor(*this));
|
||||
} else if (auto dtf = std::dynamic_pointer_cast<DecisionTreeFactor>(f)) {
|
||||
result = std::make_shared<DecisionTreeFactor>(this->operator*(*dtf));
|
||||
} else {
|
||||
// Simulate double dispatch in C++
|
||||
result = std::make_shared<DecisionTreeFactor>(f->operator*(*this));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -262,6 +262,10 @@ DiscreteFactor::shared_ptr TableFactor::multiply(
|
|||
result = std::make_shared<TableFactor>(this->operator*(*tf));
|
||||
} else if (auto dtf = std::dynamic_pointer_cast<DecisionTreeFactor>(f)) {
|
||||
result = std::make_shared<TableFactor>(this->operator*(TableFactor(*dtf)));
|
||||
} else {
|
||||
// Simulate double dispatch in C++
|
||||
result = std::make_shared<DecisionTreeFactor>(
|
||||
f->operator*(this->toDecisionTreeFactor()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue