Daniele Bartolini %!s(int64=10) %!d(string=hai) anos
pai
achega
56fab66985
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      src/core/containers/vector.h

+ 6 - 2
src/core/containers/vector.h

@@ -278,7 +278,11 @@ inline Vector<T>::Vector(const Vector<T>& other)
 	, _size(0)
 	, _data(NULL)
 {
-	*this = other;
+	const u32 size = vector::size(other);
+	vector::resize(*this, size);
+
+	for (u32 i = 0; i < size; ++i)
+		new (&_data[i]) T(other._data[i]);
 }
 
 template <typename T>
@@ -311,7 +315,7 @@ inline const Vector<T>& Vector<T>::operator=(const Vector<T>& other)
 	vector::resize(*this, size);
 
 	for (u32 i = 0; i < size; ++i)
-		_data[i] = other._data[i];
+		new (&_data[i]) T(other._data[i]);
 
 	return *this;
 }