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

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -