FastLED 3.10.6
Loading...
Searching...
No Matches

◆ reserve()

template<typename T>
void fl::deque< T >::reserve ( fl::size n)
inline

Definition at line 537 of file deque.h.

537 {
538 if (n <= capacity()) return;
539 // Allocate enough chunks behind the current front-offset to hold n total.
544 // Ensure mMap has room for `extra` more chunks past current back.
547 grow_map(0, extra);
548 }
549 // Allocate chunks at the back to cover [front .. front+n).
551 for (fl::size i = 0; i < extra; ++i) {
552 if (first_new + i >= mMapCapacity) break;
553 if (mMap[first_new + i] == nullptr) {
555 }
556 }
557 }
558 }
fl::size mMapCapacity
Definition deque.h:39
fl::size capacity() const
Definition deque.h:523
static constexpr fl::size kChunkSize
Definition deque.h:36
fl::size mSize
Definition deque.h:42
T * allocate_chunk() FL_NO_EXCEPT
Definition deque.h:45
fl::size used_chunks() const FL_NO_EXCEPT
Definition deque.h:80
fl::size mFrontOffset
Definition deque.h:41
void grow_map(fl::size extra_front, fl::size extra_back) FL_NO_EXCEPT
Definition deque.h:97
T ** mMap
Definition deque.h:38
fl::size mFrontMapIdx
Definition deque.h:40