15#if defined(USE_ESP8266) || defined(USE_LIBRETINY)
16 return std::make_unique<uint8_t[]>(n);
18 return std::make_unique_for_overwrite<uint8_t[]>(n);
39 inline void reserve(
size_t n) ESPHOME_ALWAYS_INLINE {
43 inline void resize(
size_t n) ESPHOME_ALWAYS_INLINE {
48 const uint8_t *
data()
const {
return this->
data_.get(); }
62 std::unique_ptr<uint8_t[]>
data_;
Byte buffer that skips zero-initialization on resize().
const uint8_t * data() const
void reserve(size_t n) ESPHOME_ALWAYS_INLINE
void release()
Release all memory (equivalent to std::vector swap trick).
const uint8_t & operator[](size_t i) const
uint8_t & operator[](size_t i)
void resize(size_t n) ESPHOME_ALWAYS_INLINE
std::unique_ptr< uint8_t[]> data_
std::unique_ptr< uint8_t[]> make_buffer(size_t n)
Helper to use make_unique_for_overwrite where available (skips zero-fill), falling back to make_uniqu...