diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 47775dd43c..169028be1a 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -1834,8 +1834,9 @@ template class CallbackManager { /// Call all callbacks in this manager. void call(Ts... args) { - for (uint16_t i = 0; i < this->size_; i++) - this->data_[i].call(args...); + for (auto *it = this->data_, *end = it + this->size_; it != end; ++it) { + it->call(args...); + } } uint16_t size() const { return this->size_; }