aboutsummaryrefslogtreecommitdiff
path: root/core/dvector.h
diff options
context:
space:
mode:
authorJuan Linietsky2015-02-14 12:09:52 -0300
committerJuan Linietsky2015-02-14 12:10:15 -0300
commitc5f509f238576dba39ffcce74ab2066f24e67b58 (patch)
tree888a1bc97d9fdf303a663e626599f74fb268dbff /core/dvector.h
parentd0ea4754057663d2caefbabe32421fd597a8a15d (diff)
downloadgodot-c5f509f238576dba39ffcce74ab2066f24e67b58.tar.gz
godot-c5f509f238576dba39ffcce74ab2066f24e67b58.tar.zst
godot-c5f509f238576dba39ffcce74ab2066f24e67b58.zip
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 72661882c..29be41784 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;