mirror of
https://github.com/esphome/esphome.git
synced 2026-02-25 21:43:14 -07:00
Update esphome/core/helpers.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -201,9 +201,12 @@ template<typename T> class FixedVector {
|
||||
/// This enables brace initialization: FixedVector<int> v = {1, 2, 3};
|
||||
FixedVector(std::initializer_list<T> init_list) {
|
||||
init(init_list.size());
|
||||
size_t idx = 0;
|
||||
for (const auto &item : init_list) {
|
||||
push_back(item);
|
||||
new (data_ + idx) T(item);
|
||||
++idx;
|
||||
}
|
||||
size_ = init_list.size();
|
||||
}
|
||||
|
||||
~FixedVector() { cleanup_(); }
|
||||
|
||||
Reference in New Issue
Block a user