diff --git a/esphome/core/bytebuffer.h b/esphome/core/bytebuffer.h index 462da4c1f1..4662195fb4 100644 --- a/esphome/core/bytebuffer.h +++ b/esphome/core/bytebuffer.h @@ -30,6 +30,8 @@ enum Endian { LITTLE, BIG }; * data from a buffer after it has been written. * */ + +class ByteBuffer; class ByteBuffer { public: // Default constructor (compatibility with TEMPLATABLE_VALUE) @@ -143,6 +145,11 @@ class ByteBuffer { return changed; } + ByteBuffer &operator[](size_t idx) { + this->set_position(idx); + return *this; + } + protected: ByteBuffer(std::vector const &data) : data_(data), limit_(data.size()) {} void update_() {