Search code examples
lambdaexpression-treesc++-amp

C++ combine function calls like C# expressions


What I am basically trying to do is take a string that represents a mathematical function such as

"4x^2+3"

and parse it into a function my application can invoke later. In C# I know that I can do this using the Expression Library. Once its parsed I can combine the parsed pieces without having multiple if checks or switch statements in my code.

Is there some similar way to do this in C++. I would like to parse the string once and when I plug in parameters later it will not have to parse the tree again or follow a secondary description of the function to follow.

Also bonus points if the solution can work using C++ Amp library.


Solution

  • Found the answer. The Expression library equivalent is Boost.Proto