def ccode(expr, **settings):
"""Generate C++ code from an expression calling CodePrinter class
:param expr: The expression
:param settings: A dictionary of settings for code printing
:returns: The resulting code as a string. If it fails, then it returns the expr
"""
if isinstance(expr, Eq):
return ccode_eq(expr)
try:
return CodePrinter(settings).doprint(expr, None)
except:
return expr
评论列表
文章目录