summaryrefslogtreecommitdiff
path: root/src/core/smallvec_type.hpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-09-03 21:50:51 +0000
committeryexo <yexo@openttd.org>2010-09-03 21:50:51 +0000
commita45b598bfcbbe46acbf9ea95d280fbf8d60a7b47 (patch)
tree4d7e1ca33587bc8097b6b596b789c0cc4f1ca639 /src/core/smallvec_type.hpp
parentbd379e283f4730f11bc40e9c3b583b44f9bc0a0b (diff)
downloadopenttd-a45b598bfcbbe46acbf9ea95d280fbf8d60a7b47.tar.xz
(svn r20729) -Fix [FS#4107]: assert when overbuilding object
Diffstat (limited to 'src/core/smallvec_type.hpp')
-rw-r--r--src/core/smallvec_type.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp
index 4c6c8bf04..d64f4a744 100644
--- a/src/core/smallvec_type.hpp
+++ b/src/core/smallvec_type.hpp
@@ -13,6 +13,7 @@
#define SMALLVEC_TYPE_HPP
#include "alloc_func.hpp"
+#include "mem_func.hpp"
#include "math_func.hpp"
/**
@@ -35,6 +36,12 @@ protected:
public:
SmallVector() : data(NULL), items(0), capacity(0) { }
+ template<uint X>
+ SmallVector(const SmallVector<T, X> &other) : data(NULL), items(0), capacity(0)
+ {
+ MemCpyT<T>(this->Append(other.Length()), other.Begin(), other.Length());
+ }
+
~SmallVector()
{
free(this->data);