Merge branch 'master' into floatcvt
This commit is contained in:
commit
330ca07f69
4 changed files with 157 additions and 163 deletions
34
src/tarray.h
34
src/tarray.h
|
|
@ -39,6 +39,7 @@
|
|||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <inttypes.h> // for intptr_t
|
||||
|
|
@ -137,11 +138,17 @@ public:
|
|||
Count = 0;
|
||||
Array = (T *)M_Malloc (sizeof(T)*max);
|
||||
}
|
||||
TArray (const TArray<T> &other)
|
||||
TArray (const TArray<T,TT> &other)
|
||||
{
|
||||
DoCopy (other);
|
||||
}
|
||||
TArray<T> &operator= (const TArray<T> &other)
|
||||
TArray (TArray<T,TT> &&other)
|
||||
{
|
||||
Array = other.Array; other.Array = NULL;
|
||||
Most = other.Most; other.Most = 0;
|
||||
Count = other.Count; other.Count = 0;
|
||||
}
|
||||
TArray<T,TT> &operator= (const TArray<T,TT> &other)
|
||||
{
|
||||
if (&other != this)
|
||||
{
|
||||
|
|
@ -157,6 +164,21 @@ public:
|
|||
}
|
||||
return *this;
|
||||
}
|
||||
TArray<T,TT> &operator= (TArray<T,TT> &&other)
|
||||
{
|
||||
if (Array)
|
||||
{
|
||||
if (Count > 0)
|
||||
{
|
||||
DoDelete (0, Count-1);
|
||||
}
|
||||
M_Free (Array);
|
||||
}
|
||||
Array = other.Array; other.Array = NULL;
|
||||
Most = other.Most; other.Most = 0;
|
||||
Count = other.Count; other.Count = 0;
|
||||
return *this;
|
||||
}
|
||||
~TArray ()
|
||||
{
|
||||
if (Array)
|
||||
|
|
@ -417,6 +439,14 @@ template<class T, class TT=T>
|
|||
class TDeletingArray : public TArray<T, TT>
|
||||
{
|
||||
public:
|
||||
TDeletingArray() : TArray<T,TT>() {}
|
||||
TDeletingArray(TDeletingArray<T,TT> &&other) : TArray<T,TT>(std::move(other)) {}
|
||||
TDeletingArray<T,TT> &operator=(TDeletingArray<T,TT> &&other)
|
||||
{
|
||||
TArray<T,TT>::operator=(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
|
||||
~TDeletingArray<T, TT> ()
|
||||
{
|
||||
for (unsigned int i = 0; i < TArray<T,TT>::Size(); ++i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue