FastLED 3.9.15
Loading...
Searching...
No Matches

◆ insert() [2/2]

template<typename T, fl::size N>
bool fl::FixedVector< T, N >::insert ( iterator pos,
T && value )
inline

Definition at line 314 of file vector.h.

314 {
315 if (current_size >= N) {
316 return false;
317 }
318
319 // Construct a new element at end() position using placement new
320 new (end()) T();
321 ++current_size;
322
323 // Shift elements from [pos, end-1) to the right by one position
324 for (iterator p = end() - 1; p > pos; --p) {
325 *p = fl::move(*(p - 1));
326 }
327
328 // Move-assign the new value to the insertion position
329 *pos = fl::move(value);
330 return true;
331 }
iterator end() FL_NOEXCEPT
Definition vector.h:395
fl::size current_size
Definition vector.h:439
constexpr remove_reference< T >::type && move(T &&t) FL_NOEXCEPT
Definition s16x16x4.h:28