+ 2

[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")?

23rd Jan 2021, 7:29 PM
#0009e7 [get]
#0009e7 [get] - avatar
1 Resposta
+ 8
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.
23rd Jan 2021, 7:57 PM
Aaron Eberhardt
Aaron Eberhardt - avatar