From 9fa3d891e92e70451f15c14cd69df85b51ede8f7 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 15 Dec 2022 17:28:12 +0200 Subject: [PATCH] BAN: Vector now has a copy constructor --- BAN/include/BAN/Vector.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BAN/include/BAN/Vector.h b/BAN/include/BAN/Vector.h index 446ea7edc..6c7d47d93 100644 --- a/BAN/include/BAN/Vector.h +++ b/BAN/include/BAN/Vector.h @@ -19,6 +19,7 @@ namespace BAN public: Vector() = default; + Vector(const Vector&); ~Vector(); ErrorOr PushBack(const T&); @@ -51,6 +52,15 @@ namespace BAN size_type m_size = 0; }; + template + Vector::Vector(const Vector& other) + { + MUST(EnsureCapasity(other.m_size)); + for (size_type i = 0; i < other.m_size; i++) + m_data[i] = other[i]; + m_size = other.m_size; + } + template Vector::~Vector() {