| 108 | : variables(std::move(variables)), expr(std::move(expr)) {} |
| 109 | |
| 110 | double generate(const Context& ctx) override { |
| 111 | // Create a new context |
| 112 | Context new_context{ctx}; |
| 113 | |
| 114 | // Set values in the context by evaluating the generators |
| 115 | for (auto const& var : variables) { |
| 116 | new_context.set(var.first, var.second->generate(ctx)); |
| 117 | } |
| 118 | |
| 119 | // Evaluate the expression in the new context |
| 120 | return expr->generate(new_context); |
| 121 | } |
| 122 | std::string str() const override { |
| 123 | auto result = "["s; |
| 124 | for (auto const& var : variables) { |