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 258 of file vector.h.

258 {
259 if (current_size < N) {
260 // shift all element from pos to end to the right
261 for (iterator p = end(); p != pos; --p) {
262 T temp = fl::move(*(p - 1));
263 (p)->~T(); // Destroy the current element
264 // Clear the memory
265 void *vp = static_cast<void *>(p);
266 fl::memfill(vp, 0, sizeof(T));
267 new (p) T(fl::move(temp)); // Use move constructor
268 }
269 ++current_size;
270 // now insert the new value
271 new (pos) T(value);
272 return true;
273 }
274 return false;
275 }
fl::size current_size
Definition vector.h:341
iterator end()
Definition vector.h:324
constexpr remove_reference< T >::type && move(T &&t) noexcept
Definition move.h:27
void * memfill(void *ptr, int value, fl::size num)
Definition memfill.h:11