FastLED 3.9.15
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 330 of file basic_vector.cpp.hpp.

330 {
331 if (n == mSize) return;
332
333 if (n < mSize) {
334 if (mOps) {
335 for (fl::size i = n; i < mSize; ++i) {
336 mOps->destroy(element_ptr(i));
337 }
338 }
339 mSize = n;
340 return;
341 }
342
344 if (mCapacity < n) return;
345
346 if (mOps) {
347 for (fl::size i = mSize; i < n; ++i) {
348 mOps->copy_construct(element_ptr(i), value);
349 }
350 } else {
351 for (fl::size i = mSize; i < n; ++i) {
353 }
354 }
355 mSize = n;
356}
const vector_element_ops * mOps
fl::size mElementSize
void ensure_capacity(fl::size n) FL_NOEXCEPT
Ensure capacity for at least n elements. Grows if needed.
void * element_ptr(fl::size index) FL_NOEXCEPT
Pointer to element at index (byte arithmetic).
void * memcpy(void *dest, const void *src, size_t n) FL_NOEXCEPT
constexpr int type_rank< T >::value

References element_ptr(), ensure_capacity(), 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: