forked from Bananymous/banan-os
BAN: Vector now has a copy constructor
This commit is contained in:
parent
7bddcafadd
commit
9fa3d891e9
|
@ -19,6 +19,7 @@ namespace BAN
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Vector() = default;
|
Vector() = default;
|
||||||
|
Vector(const Vector<T>&);
|
||||||
~Vector();
|
~Vector();
|
||||||
|
|
||||||
ErrorOr<void> PushBack(const T&);
|
ErrorOr<void> PushBack(const T&);
|
||||||
|
@ -51,6 +52,15 @@ namespace BAN
|
||||||
size_type m_size = 0;
|
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>
|
template<typename T>
|
||||||
Vector<T>::~Vector()
|
Vector<T>::~Vector()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue