MCPcopy Create free account
hub / github.com/davisking/dlib / push_back

Method push_back

dlib/array/array_kernel.h:760–783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

758 typename mem_manager
759 >
760 void array<T,mem_manager>::
761 push_back (
762 T& item
763 )
764 {
765 if (this->max_size() == this->size())
766 {
767 // double the size of the array
768 array temp;
769 temp.set_max_size(this->size()*2 + 1);
770 temp.set_size(this->size()+1);
771 for (size_t i = 0; i < this->size(); ++i)
772 {
773 exchange((*this)[i],temp[i]);
774 }
775 exchange(item,temp[temp.size()-1]);
776 temp.swap(*this);
777 }
778 else
779 {
780 this->set_size(this->size()+1);
781 exchange(item,(*this)[this->size()-1]);
782 }
783 }
784
785// ----------------------------------------------------------------------------------------
786

Callers

nothing calls this directly

Calls 8

sizeMethod · 0.95
exchangeFunction · 0.85
push_backClass · 0.85
set_max_sizeMethod · 0.80
max_sizeMethod · 0.45
set_sizeMethod · 0.45
sizeMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected