diff --git a/SeQuant/core/parse/deparse.cpp b/SeQuant/core/parse/deparse.cpp index 25a6d0c4d..c95690ffc 100644 --- a/SeQuant/core/parse/deparse.cpp +++ b/SeQuant/core/parse/deparse.cpp @@ -96,18 +96,23 @@ std::wstring deparse_scalar(const Constant::scalar_type& scalar) { } // namespace details std::wstring deparse(const ExprPtr& expr, bool annot_sym) { - using namespace details; if (!expr) return {}; - if (expr->is()) - return deparse(expr->as(), annot_sym); - else if (expr->is()) - return deparse(expr->as(), annot_sym); - else if (expr->is()) - return deparse(expr->as(), annot_sym); - else if (expr->is()) - return deparse(expr->as()); - else if (expr->is()) - return deparse(expr->as()); + + return deparse(*expr, annot_sym); +} + +std::wstring deparse(const Expr& expr, bool annot_sym) { + using namespace details; + if (expr.is()) + return deparse(expr.as(), annot_sym); + else if (expr.is()) + return deparse(expr.as(), annot_sym); + else if (expr.is()) + return deparse(expr.as(), annot_sym); + else if (expr.is()) + return deparse(expr.as()); + else if (expr.is()) + return deparse(expr.as()); else throw std::runtime_error("Unsupported expr type for deparse!"); }