mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
[core] Use a user provided default constructor for Automation (#19197)
This commit is contained in:
@@ -608,7 +608,9 @@ template<typename... Ts> class ActionList {
|
||||
template<typename... Ts> class Automation {
|
||||
public:
|
||||
/// Default constructor for use with TriggerForwarder (no Trigger object needed).
|
||||
Automation() = default;
|
||||
// User provided, not "= default": `new(p) Automation()` would zero-fill .bss that is already zero.
|
||||
// constexpr and noexcept keep the rest of the implicit constructor's contract.
|
||||
constexpr Automation() noexcept {}
|
||||
explicit Automation(Trigger<Ts...> *trigger) { trigger->set_automation_parent(this); }
|
||||
|
||||
void add_action(Action<Ts...> *action) { this->actions_.add_action(action); }
|
||||
|
||||
Reference in New Issue
Block a user