Index: src/core/smallvec_type.hpp =================================================================== --- src/core/smallvec_type.hpp (wersja 24434) +++ src/core/smallvec_type.hpp (kopia robocza) @@ -39,21 +39,39 @@ * Copy constructor. * @param other The other vector to copy. */ + SmallVector(const SmallVector &other) : data(NULL), items(0), capacity(0) + { + this->Assign(other); + } + + /** + * Generic copy constructor. + * @param other The other vector to copy. + */ template SmallVector(const SmallVector &other) : data(NULL), items(0), capacity(0) { - MemCpyT(this->Append(other.Length()), other.Begin(), other.Length()); + this->Assign(other); } /** * Assignment. - * @param other The new vector that. + * @param other The other vector to assign. */ + SmallVector &operator=(const SmallVector &other) + { + this->Assign(other); + return *this; + } + + /** + * Generic assignment. + * @param other The other vector to assign. + */ template SmallVector &operator=(const SmallVector &other) { - this->Reset(); - MemCpyT(this->Append(other.Length()), other.Begin(), other.Length()); + this->Assign(other); return *this; } @@ -63,6 +81,18 @@ } /** + * Assign items from other vector. + */ + template + inline void Assign(const SmallVector &other) + { + this->items = other.Length(); + this->capacity = Align(this->items, S); + this->data = ReallocT(this->data, this->capacity); + MemCpyT(this->data, other.Begin(), other.Length()); + } + + /** * Remove all items from the list. */ inline void Clear()