summaryrefslogtreecommitdiff
path: root/core/dvector.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/dvector.h')
-rw-r--r--core/dvector.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/dvector.h b/core/dvector.h
index 72661882cd..29be417844 100644
--- a/core/dvector.h
+++ b/core/dvector.h
@@ -262,6 +262,23 @@ public:
w[bs+i]=r[i];
}
+
+ Error insert(int p_pos,const T& p_val) {
+
+ int s=size();
+ ERR_FAIL_INDEX_V(p_pos,s+1,ERR_INVALID_PARAMETER);
+ resize(s+1);
+ {
+ Write w = write();
+ for (int i=s;i>p_pos;i--)
+ w[i]=w[i-1];
+ w[p_pos]=p_val;
+ }
+
+ return OK;
+ }
+
+
bool is_locked() const { return mem.is_locked(); }
inline const T operator[](int p_index) const;