diff --git a/esphome/components/mdns/mdns_component.h b/esphome/components/mdns/mdns_component.h index 241c32079e..141e42d976 100644 --- a/esphome/components/mdns/mdns_component.h +++ b/esphome/components/mdns/mdns_component.h @@ -62,7 +62,7 @@ class MDNSComponent : public Component { /// Add a dynamic TXT value and return pointer to it for use in MDNSTXTRecord const char *add_dynamic_txt_value(const std::string &value) { this->dynamic_txt_values_.push_back(value); - return this->dynamic_txt_values_.back().c_str(); + return this->dynamic_txt_values_[this->dynamic_txt_values_.size() - 1].c_str(); } /// Storage for runtime-generated TXT values (MAC address, user lambdas) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 309c2869e3..e06f2d15ef 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -146,15 +146,6 @@ template class StaticVector { T &operator[](size_t i) { return data_[i]; } const T &operator[](size_t i) const { return data_[i]; } - T &back() { - assert(count_ > 0 && "back() called on empty StaticVector"); - return data_[count_ - 1]; - } - const T &back() const { - assert(count_ > 0 && "back() called on empty StaticVector"); - return data_[count_ - 1]; - } - // For range-based for loops iterator begin() { return data_.begin(); } iterator end() { return data_.begin() + count_; }