From 3636ab68f3d11cfa2a28546310e714dba38b6045 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 29 Oct 2025 15:06:08 -0500 Subject: [PATCH] tidy --- esphome/core/template_lambda.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/esphome/core/template_lambda.h b/esphome/core/template_lambda.h index 8e7f71b7b2..1977265c33 100644 --- a/esphome/core/template_lambda.h +++ b/esphome/core/template_lambda.h @@ -32,7 +32,7 @@ template class TemplateLambda { template requires std::invocable && std::convertible_to < F, optional(*) (Args...) > void set(F f) { - this->reset(); + this->reset_(); this->type_ = STATELESS_LAMBDA; this->stateless_f_ = f; // Implicit conversion to function pointer } @@ -42,12 +42,12 @@ template class TemplateLambda { requires std::invocable && (!std::convertible_to (*)(Args...)>) &&std::convertible_to, optional> void set(F &&f) { - this->reset(); + this->reset_(); this->type_ = LAMBDA; this->f_ = new std::function(Args...)>(std::forward(f)); } - ~TemplateLambda() { this->reset(); } + ~TemplateLambda() { this->reset_(); } // Copy constructor TemplateLambda(const TemplateLambda &) = delete; @@ -66,7 +66,7 @@ template class TemplateLambda { TemplateLambda &operator=(TemplateLambda &&other) noexcept { if (this != &other) { - this->reset(); + this->reset_(); this->type_ = other.type_; if (type_ == LAMBDA) { this->f_ = other.f_; @@ -97,7 +97,7 @@ template class TemplateLambda { optional call(Args... args) { return (*this)(args...); } protected: - void reset() { + void reset_() { if (this->type_ == LAMBDA) { delete this->f_; this->f_ = nullptr;