FastLED 3.10.8
Loading...
Searching...
No Matches

◆ resize_value_impl()

void fl::vector_basic::resize_value_impl ( fl::size n,
const void * value )

Resize to n elements. New elements are copy-constructed from value.

Definition at line 339 of file basic_vector.cpp.hpp.

339 {
340 if (n == mSize) return;
341
342 if (n < mSize) {
343 if (mOps) {
344 mOps->destroy_n(element_ptr(n), mSize - n);
345 }
346 mSize = n;
347 return;
348 }
349
351 if (mCapacity < n) return;
352
353 if (mOps) {
354 for (fl::size i = mSize; i < n; ++i) {
355 mOps->copy_construct(element_ptr(i), value);
356 }
357 } else {
358 for (fl::size i = mSize; i < n; ++i) {
360 }
361 }
362 mSize = n;
363}
const vector_element_ops * mOps
void ensure_capacity(fl::size n) FL_NO_EXCEPT
Ensure capacity for at least n elements. Grows if needed.
void * element_ptr(fl::size index) FL_NO_EXCEPT
Pointer to element at index (byte arithmetic).
fl::size mElementSize
constexpr int type_rank< T >::value
FASTLED_FORCE_INLINE void * memcpy(void *dest, const void *src, size_t n) FL_NO_EXCEPT
Definition cstring.h:136

References element_ptr(), ensure_capacity(), fl::FL_NO_EXCEPT, mCapacity, mElementSize, fl::memcpy(), mOps, mSize, and fl::type_rank< T >::value.

Referenced by fl::vector< fl::i16 >::vector(), fl::vector< fl::i16 >::vector(), fl::VectorN< T, INLINED_SIZE >::VectorN(), and fl::vector< fl::i16 >::resize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: