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

◆ insert() [1/2]

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

Definition at line 294 of file vector.h.

294 {
295 if (current_size >= N) {
296 return false;
297 }
298
299 // Construct a new element at end() position using placement new
300 new (end()) T();
301 ++current_size;
302
303 // Shift elements from [pos, end-1) to the right by one position
304 for (iterator p = end() - 1; p > pos; --p) {
305 *p = fl::move(*(p - 1));
306 }
307
308 // Assign the new value to the insertion position
309 *pos = value;
310 return true;
311 }
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