MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / insert

Method insert

Engine/lib/collada/include/dae/daeArray.h:373–388  ·  view source on GitHub ↗

* Inserts the specified number of elements at a specific location in the array. * @param index Index into the array where the elements will be inserted * @param n The number of elements to insert * @param val The value to insert */

Source from the content-addressed store, hash-verified

371 * @param val The value to insert
372 */
373 void insert(size_t index, size_t n, const T& val = T()) {
374 if (index >= _count) {
375 // Append to the end of the array
376 size_t oldCount = _count;
377 setCount(index + n);
378 for (size_t i = oldCount; i < _count; i++)
379 get(i) = val;
380 }
381 else {
382 setCount(_count + n);
383 for (size_t i = _count-1; i >= index+n; i--)
384 get(i) = get(i-n);
385 for (size_t i = index; i < index+n; i++)
386 get(i) = val;
387 }
388 }
389
390 /**
391 * Inserts an object at a specific index in the daeArray, growing the array if neccessary

Callers 4

insertElementMethod · 0.45
changeElementIDMethod · 0.45
validateMethod · 0.45
nativePathToUriMethod · 0.45

Calls 2

TFunction · 0.50
getFunction · 0.50

Tested by

no test coverage detected