[binary_sensor] Replace std::bind with inline lambda in MultiClickTrigger

Replace std::bind(&MultiClickTrigger::on_state_, this, _1) with a
[this] lambda for the add_on_state_callback registration. The [this]
lambda fits within the Callback inline storage threshold
(sizeof(void*)), avoiding a permanent heap allocation.
This commit is contained in:
J. Nick Koston
2026-03-19 00:04:55 -10:00
parent 403ba262c6
commit 3bc7efb479
@@ -96,8 +96,7 @@ class MultiClickTrigger : public Trigger<>, public Component {
void setup() override {
this->last_state_ = this->parent_->get_state_default(false);
auto f = std::bind(&MultiClickTrigger::on_state_, this, std::placeholders::_1);
this->parent_->add_on_state_callback(f);
this->parent_->add_on_state_callback([this](bool state) { this->on_state_(state); });
}
float get_setup_priority() const override { return setup_priority::HARDWARE; }