BAN: Vector now has a copy constructor

This commit is contained in:
Bananymous 2022-12-15 17:28:12 +02:00
parent 7bddcafadd
commit 9fa3d891e9
1 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,7 @@ namespace BAN
public:
Vector() = default;
Vector(const Vector<T>&);
~Vector();
ErrorOr<void> PushBack(const T&);
@ -51,6 +52,15 @@ namespace BAN
size_type m_size = 0;
};
template<typename T>
Vector<T>::Vector(const Vector<T>& 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<typename T>
Vector<T>::~Vector()
{