360 {
361
362
363
364
365
367 bool other_inline = other.isInline();
368
369 if (!this_inline && !other_inline) {
370
373 other.mArray = tmp_array;
374
377 other.mCapacity = tmp_cap;
378 } else if (this_inline && other_inline) {
379
380 fl::size max_size =
mSize > other.mSize ?
mSize : other.mSize;
381 for (fl::size i = 0; i < max_size; ++i) {
382 if (i <
mSize && i < other.mSize) {
385 } else {
387 }
388 }
else if (i <
mSize) {
389
393 } else {
395 }
396 } else {
397
400 mOps->destroy(other.element_ptr(i));
401 } else {
403 }
404 }
405 }
406 } else if (this_inline) {
407
408
409
410 void* other_array = other.mArray;
411 fl::size other_cap = other.mCapacity;
412
413
414 if (other.hasInlineBuffer() &&
mSize <= other.mInlineCapacity) {
415 other.mArray = other.inlineBufferPtr();
416 other.mCapacity = other.mInlineCapacity;
420 } else {
422 }
423 } else {
424
426 other.mCapacity =
mSize;
430 } else {
432 }
433 }
434
435
438 } else {
439
440 other.swap_impl(*this);
441 return;
442 }
443
444
445 fl::size tmp_size =
mSize;
447 other.mSize = tmp_size;
448
449
452 other.mResource = tmp_res;
453}
const vector_element_ops * mOps
bool isInline() const FL_NOEXCEPT
Is data currently in the inline buffer?
memory_resource * mResource
void trivial_swap(void *a, void *b) const FL_NOEXCEPT
void trivial_copy(void *dst, const void *src, fl::size count) const FL_NOEXCEPT
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