aboutsummaryrefslogtreecommitdiff
path: root/core/dvector.h
diff options
context:
space:
mode:
authorAnton Yabchinskiy2015-02-17 15:57:24 +0300
committerAnton Yabchinskiy2015-02-17 15:57:24 +0300
commite024ff89b224f803fe335efa95d3e99bffc3423f (patch)
tree84ca5323c97ef24cfcae202447ac6967783e9248 /core/dvector.h
parent6f93e6812edaf6c8c79c28dadbe5f1c4a8ced93e (diff)
parent2bea642583efeb68886e71950384f297f2d7ee12 (diff)
downloadgodot-e024ff89b224f803fe335efa95d3e99bffc3423f.tar.gz
godot-e024ff89b224f803fe335efa95d3e99bffc3423f.tar.zst
godot-e024ff89b224f803fe335efa95d3e99bffc3423f.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;