From b204389762cdaa4b5327e4a655041ef3be05232f Mon Sep 17 00:00:00 2001 From: AndreaCatania Date: Tue, 21 Nov 2017 01:11:39 +0100 Subject: [PATCH] Added function append_array to vector --- core/vector.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/vector.h b/core/vector.h index f586471e270..c026448ddd8 100644 --- a/core/vector.h +++ b/core/vector.h @@ -152,6 +152,8 @@ public: Error insert(int p_pos, const T &p_val); + void append_array(const Vector &p_other); + template void sort_custom() { @@ -407,6 +409,17 @@ Error Vector::insert(int p_pos, const T &p_val) { return OK; } +template +void Vector::append_array(const Vector &p_other) { + const int ds = p_other.size(); + if (ds == 0) + return; + const int bs = size(); + resize(bs + ds); + for (int i = 0; i < ds; ++i) + operator[](bs + i) = p_other[i]; +} + template Vector::Vector(const Vector &p_from) {