diff --git a/esphome/components/copy/select/copy_select.cpp b/esphome/components/copy/select/copy_select.cpp index be90af5a13..bdcbd0b42c 100644 --- a/esphome/components/copy/select/copy_select.cpp +++ b/esphome/components/copy/select/copy_select.cpp @@ -9,8 +9,7 @@ static const char *const TAG = "copy.select"; void CopySelect::setup() { source_->add_on_state_callback([this](const std::string &value, size_t index) { this->publish_state(value); }); - const auto &source_options = source_->traits.get_options(); - traits.set_options(source_options); + traits.set_options(source_->traits.get_options()); if (source_->has_state()) this->publish_state(source_->state); diff --git a/esphome/components/select/select.cpp b/esphome/components/select/select.cpp index 66cd51e15a..5961d71faa 100644 --- a/esphome/components/select/select.cpp +++ b/esphome/components/select/select.cpp @@ -54,7 +54,7 @@ optional Select::active_index() const { optional Select::at(size_t index) const { if (this->has_index(index)) { const auto &options = traits.get_options(); - return std::string(options.at(index)); + return std::string(options[index]); } else { return {}; } diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 7b4f2ad21f..15f05b9b6f 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -322,11 +322,6 @@ template class FixedVector { T &operator[](size_t i) { return data_[i]; } const T &operator[](size_t i) const { return data_[i]; } - /// Access element with bounds checking (matches std::vector behavior) - /// Caller must ensure index is valid (i < size()) - T &at(size_t i) { return data_[i]; } - const T &at(size_t i) const { return data_[i]; } - // Iterator support for range-based for loops T *begin() { return data_; } T *end() { return data_ + size_; }