MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / InsertAt

Method InsertAt

source/script_object.cpp:1807–1825  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1805
1806template<typename TokenT>
1807ResultType Array::InsertAt(index_t aIndex, TokenT aValue[], index_t aCount)
1808{
1809 ASSERT(aIndex <= mLength);
1810
1811 if (!EnsureCapacity(mLength + aCount))
1812 return FAIL;
1813
1814 if (aIndex < mLength)
1815 {
1816 memmove(mItem + aIndex + aCount, mItem + aIndex, (mLength - aIndex) * sizeof(mItem[0]));
1817 }
1818 for (index_t i = 0; i < aCount; ++i)
1819 {
1820 mItem[aIndex + i].Minit();
1821 mItem[aIndex + i].Assign(aValue[i]);
1822 }
1823 mLength += aCount;
1824 return OK;
1825}
1826
1827template ResultType Array::InsertAt(index_t, ExprTokenType *[], index_t);
1828template ResultType Array::InsertAt(index_t, ExprTokenType [], index_t);

Callers 2

CallMethod · 0.80
CreateMethod · 0.80

Calls 2

MinitMethod · 0.80
AssignMethod · 0.45

Tested by

no test coverage detected