MCPcopy Create free account
hub / github.com/LiangliangNan/PolyFit / insert

Method insert

code/3rd_party/soplex/src/array.h:120–157  ·  view source on GitHub ↗

insert \p n uninitialized elements before \p i 'th element. * * You must not! use realloc, memcpy or memmove, because some data element points inside itself, and therefore you * always need to copy all elements by hand. */

Source from the content-addressed store, hash-verified

118 * always need to copy all elements by hand.
119 */
120 void insert(int i, int n)
121 {
122 assert(i <= num);
123 assert(num >= 0);
124 if (n > 0)
125 {
126 T* newdata = 0;
127 int k;
128
129 spx_alloc(newdata, num + n);
130 assert(newdata != 0);
131
132 // copy front segment to new array
133 for( k = 0; k < i; ++k )
134 {
135 new (&(newdata[k])) T();
136 newdata[k] = data[k];
137 data[k].~T();
138 }
139
140 // call constructor for new elements
141 for( ; k < i+n; ++k )
142 new (&(newdata[k])) T();
143
144 // copy rear segment to new array
145 for( k = i; k < num; ++k )
146 {
147 new (&(newdata[n + k])) T();
148 newdata[n + k] = data[k];
149 data[k].~T();
150 }
151
152 if( data )
153 spx_free(data);
154 data = newdata;
155 num += n;
156 }
157 }
158
159 /// insert \p n elements from \p p_array before \p i 'th element.
160 void insert(int i, int n, const T* p_array)

Callers 13

SCIPexprintCompileFunction · 0.45
RevSparseJacCaseMethod · 0.45
RevSparseHesCaseMethod · 0.45
ForSparseJacCaseMethod · 0.45
ForSparseHesCaseMethod · 0.45
for_sparse_jacMethod · 0.45
rev_sparse_jacMethod · 0.45
rev_sparse_hesMethod · 0.45
color_symmetric_cppadFunction · 0.45
std_set.hppFile · 0.45
get_internal_sparsityFunction · 0.45

Calls 3

spx_allocFunction · 0.85
spx_freeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected