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

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -