TArray list constructor
This commit is contained in:
parent
8a020fbe9d
commit
29b2253bdb
1 changed files with 23 additions and 0 deletions
|
|
@ -231,6 +231,29 @@ public:
|
|||
ConstructEmpty(0, Count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
TArray (std::initializer_list<T> list)
|
||||
{
|
||||
Most = list.size;
|
||||
Count = list.size;
|
||||
|
||||
if (Count > 0)
|
||||
{
|
||||
Array = (T *)M_Malloc (sizeof(T) * Count);
|
||||
|
||||
const T* it = list.begin();
|
||||
|
||||
for (unsigned int i = 0; i < Count; ++i)
|
||||
{
|
||||
::new(&Array[i]) T(*it++);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Array = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
TArray (const TArray<T,TT> &other)
|
||||
{
|
||||
DoCopy (other);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue