# qme **Repository Path**: youngwolf/qme ## Basic Information - **Project Name**: qme - **Description**: C/C++风格的问号表达式,一次编译,多次运行。 - **Primary Language**: Unknown - **License**: BSL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-01-12 - **Last Updated**: 2025-11-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # qme Question mark expression just as C/C++'s - Overview - Compile once and execute any times with different values of the variables in the question mark expression.
Recursion is used during the whole compilation and execution, so please carefully control the number of variables in your question mark expressions, and enlage the size of the stack if inevitable, or use
qme::O0/qme::O1 to compile it,
qme::safe_execute to execute it and
qme::safe_delete to delete it,
then no recursion will be introduced (except question mark expression used as sub expression). Quick start - Execute make or make debug, then execute ./test_question_exp Example: - ``` auto cb = [](const std::map& dm, const std::string& variable_name) { auto iter = dm.find(variable_name); if (iter == std::end(dm)) throw("undefined symbol " + variable_name); return iter->second; }; std::map dm_1; dm_1["a"] = -100.f; dm_1["b"] = 1.f; dm_1["c"] = 11.f; auto cb_1 = [&](const std::string& variable_name) {return cb(dm_1, variable_name);}; auto exp = qme::compiler<>::compile<>("a > 0 ? b > 0 ? b : 100 : c + 1"); if (exp) { puts("perform the question mark expression:"); try {printf("%f\n", (*exp)(cb_1));} catch (const std::exception& e) {puts(e.what());} catch (const std::string& e) {puts(e.data());} catch (const char* e) {puts(e);} catch (...) {puts("unknown exception happened!");} } ``` Compiler requirement: - Visual C++ 11.0, GCC 4.7 or Clang 3.1 at least, with c++11 features;
email: mail2tao@163.com - Community on QQ: 198941541 -