From fe1270e4c1ae0169406ea8d083f38164ae67d383 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 29 Oct 2025 16:45:29 -0500 Subject: [PATCH] forward args --- esphome/core/template_lambda.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/core/template_lambda.h b/esphome/core/template_lambda.h index 894b5edffa..7b8f4374aa 100644 --- a/esphome/core/template_lambda.h +++ b/esphome/core/template_lambda.h @@ -35,14 +35,14 @@ template class TemplateLambda { bool has_value() const { return this->f_ != nullptr; } /** Call the lambda, returning nullopt if no lambda is set */ - optional operator()(Args... args) { + optional operator()(Args &&...args) { if (this->f_ == nullptr) return nullopt; - return this->f_(args...); + return this->f_(std::forward(args)...); } /** Alias for operator() for compatibility */ - optional call(Args... args) { return (*this)(args...); } + optional call(Args &&...args) { return (*this)(std::forward(args)...); } protected: optional (*f_)(Args...); // Function pointer (4 bytes on ESP32)