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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -