28{
29 const std::string expression = "a * sin(3x) + foo(abs(y - z) / w)";
30
32
33
34
35
36
37 symbol_table.
add_function(
"foo",[](T )->T {
return T(0); });
38
39 std::deque<std::string> variable_list;
40 std::deque<std::string> function_list;
41
43 {
44 printf("Error: Failed to collect variables for expression: %s\n",expression.c_str());
45 variable_list.clear();
46 }
47
49 {
50 printf("Error: Failed to collect functions for expression: %s\n",expression.c_str());
51 function_list.clear();
52 }
53
54 for (const auto& var : variable_list)
55 {
56 printf("variable: %s\n",var.c_str());
57 }
58
59 for (const auto& func : function_list)
60 {
61 printf("function: %s\n",func.c_str());
62 }
63}
bool add_function(const std::string &function_name, function_t &function)
bool collect_variables(const std::string &expression, Sequence< std::string, Allocator > &symbol_list)
bool collect_functions(const std::string &expression, Sequence< std::string, Allocator > &symbol_list)