MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / assign

Method assign

paddle/utils/small_vector.h:723–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721 void append(const small_vector_impl &RHS) { append(RHS.begin(), RHS.end()); }
722
723 void assign(size_type NumElts, ValueParamT Elt) {
724 // Note that Elt could be an internal reference.
725 if (NumElts > this->capacity()) {
726 this->growAndAssign(NumElts, Elt);
727 return;
728 }
729
730 // Assign over existing elements.
731 std::fill_n(this->begin(), (std::min)(NumElts, this->size()), Elt);
732 if (NumElts > this->size())
733 std::uninitialized_fill_n(this->end(), NumElts - this->size(), Elt);
734 else if (NumElts < this->size())
735 this->destroy_range(this->begin() + NumElts, this->end());
736 this->set_size(NumElts);
737 }
738
739 // FIXME: Consider assigning over existing elements, rather than clearing &
740 // re-initializing them - for all assign(...) variants.

Callers 2

small_vectorMethod · 0.45
small_vectorClass · 0.45

Calls 11

set_sizeMethod · 0.80
clearFunction · 0.50
appendFunction · 0.50
assignFunction · 0.50
capacityMethod · 0.45
growAndAssignMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45
destroy_rangeMethod · 0.45

Tested by

no test coverage detected