在 C++ 中评估数学表达式的最佳方法是什么? [英] What is the best way to evaluate mathematical expressions in C++?

查看:33
本文介绍了在 C++ 中评估数学表达式的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,评估任何自定义数学表达式的最佳方法是什么

What is the best way to evaluate any custom math expression, for example

3+sqrt(5)+pow(3)+log(5)

我知道将 Python 嵌入 C++ 可以做到这一点;有没有更好的办法?

I know that embedding Python into C++ can do that; is there any better way?

谢谢!

推荐答案

Boost.Spirit 是一个 C++ 解析器库.

Boost.Spirit is a C++ parser library.

示例:

  • in its distribution: classic version and current version (look for "calc");
  • on Rosetta wiki;
  • some applications using it.

这篇关于在 C++ 中评估数学表达式的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆