diff --git a/gtsam/discrete/DecisionTree-inl.h b/gtsam/discrete/DecisionTree-inl.h index 3c74e57fda..ab14b2a726 100644 --- a/gtsam/discrete/DecisionTree-inl.h +++ b/gtsam/discrete/DecisionTree-inl.h @@ -261,9 +261,8 @@ namespace gtsam { // Check if zero if (!showZero) { - const Leaf* leaf = dynamic_cast (branch.get()); - std::string value = valueFormatter(leaf->constant()); - if (leaf && value.compare("0")) continue; + const Leaf* leaf = dynamic_cast(branch.get()); + if (leaf && valueFormatter(leaf->constant()).compare("0")) continue; } os << "\"" << this->id() << "\" -> \"" << branch->id() << "\"";