MCPcopy Create free account
hub / github.com/9miao/CrossApp / insert

Method insert

scripting/javascript/spidermonkey-android/include/js/Vector.h:866–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

864
865template <class T, size_t N, class AP>
866inline bool
867Vector<T,N,AP>::insert(T *p, const T &val)
868{
869 JS_ASSERT(begin() <= p && p <= end());
870 size_t pos = p - begin();
871 JS_ASSERT(pos <= mLength);
872 size_t oldLength = mLength;
873 if (pos == oldLength)
874 return append(val);
875 {
876 T oldBack = back();
877 if (!append(oldBack)) /* Dup the last element. */
878 return false;
879 }
880 for (size_t i = oldLength; i > pos; --i)
881 (*this)[i] = (*this)[i - 1];
882 (*this)[pos] = val;
883 return true;
884}
885
886template<typename T, size_t N, class AP>
887inline void

Callers

nothing calls this directly

Calls 4

backFunction · 0.85
beginFunction · 0.50
endFunction · 0.50
appendFunction · 0.50

Tested by

no test coverage detected