Math Expression Node in c++

Is there something like the math expression node which I can use in c++? I found the FMath::Eval() function but this function cannot evaluate with variables.


The short answer is no. However, if you need to parse a string expression for evaluation, there are some solutions (go here for examples: Evaluating arithmetic expressions from string in C++ - Stack Overflow), but they involve third-party libraries. There is, however, a disadvantage, because they can’t be used in portable code, since usually no correct cross-platform behavior is guaranteed.

The fact that no Math Expression Node isn’t provided in C++ is reasonable since there aren’t many scenarios when this functionality is actually needed in C++. Please note, that Blueprints provide tools mostly for designers, not programmers.

Thus, when working in C++, it is more appropriate to use Math functions provided by language’s standard library and Unreal Engine library for evaluating expressions.

1 Like