[solved] Any C++ evaluation function? | SoloLearn: Learn to code for FREE!


[solved] Any C++ evaluation function?

Is there any function in standard library of C++ to evaluate the string as C++ code (like Python and JavaScript's "eval")?


1/23/2021 7:29:35 PM


1 Answer

New Answer


No, by design this is not possible. C++ is a compiled language that is supposed to compile into a binary that can be executed by an operating system. This makes it a lot faster but also means it is less flexible at runtime. In general eval is rarely useful, often seen as bad habit and can be rewritten in more robust code.