MCPcopy Create free account
hub / github.com/apache/arrow / assign_by_copying

Method assign_by_copying

cpp/src/arrow/util/small_vector.h:476–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

474
475 template <typename InputIt>
476 void assign_by_copying(size_t n, InputIt src) {
477 const size_t old_size = storage_.size_;
478 if (n > old_size) {
479 storage_.bump_size(n - old_size);
480 auto* dest = storage_.storage_ptr();
481 for (size_t i = 0; i < old_size; ++i, ++src) {
482 dest[i].assign(*src);
483 }
484 for (size_t i = old_size; i < n; ++i, ++src) {
485 dest[i].construct(*src);
486 }
487 } else {
488 auto* dest = storage_.storage_ptr();
489 for (size_t i = 0; i < n; ++i, ++src) {
490 dest[i].assign(*src);
491 }
492 for (size_t i = n; i < old_size; ++i) {
493 dest[i].destroy();
494 }
495 storage_.reduce_size(old_size - n);
496 }
497 }
498
499 template <typename InputIt>
500 void assign_by_moving(size_t n, InputIt src) {

Callers

nothing calls this directly

Calls 6

assignMethod · 0.80
bump_sizeMethod · 0.45
storage_ptrMethod · 0.45
constructMethod · 0.45
destroyMethod · 0.45
reduce_sizeMethod · 0.45

Tested by

no test coverage detected