c++ - Calculate expression string consists of keys in a std::map -
i have c++ std::map object like
std::map<std::string, int> data = {{"a",1},{"b",2}};
and have string expression consists of keys in map:
"(a%2)+2*((b-2)%2)"
all want calculate value of expression, , return type should int
. there way this? maybe boost
package helpful.
exprtk seems looking for, seems simple use , requires #include "exprtk.hpp"
.
this can done using boost
, show in answers question.
Comments
Post a Comment